The crowd in Tahrir Square that cheered Sunday’s victory by Muslim Brotherhood candidate Mohammed Morsi in a presidential run off, didn’t represent a majority of Egyptians. His triumph is both a victory – and a potential disaster – for democracy, and for Egypt.

It is a victory, because Morsi is now the first democratically elected president of Egypt. A member of a once banned Islamist group, he won the vote by a narrow 51 percent last week. Despite speculation that the Egyptian military would overturn that result, the Egyptian Election Commission finally declared the winner.

But Morsi’s win is no guarantee of democracy’s triumph. Most of the crowd in Tahrir Square were members of the Brotherhood’s core supporters, many bused in from the countryside. But the group’s sectarian behavior in parliament, after winning a dominant 47 percent of the parliamentary seats last year, sharply diminished its popularity among a broad expanse of Egyptians.

The Brotherhood tried to monopolize all power in parliament, and to squeeze out other voices in writing a new constitution. It alienated moderate Muslims, seculars, many women, and Christians. In the first round of presidential elections, in May, Morsi won only around 25 percent of the vote, half of what the Brotherhood received in the parliamentary ballot. In that first round, moderates and seculars split 50 percent of total votes cast between several other candidates; had they targeted their vote for one candidate, Morsi would have lost.

Instead, in the runoff election, voters were left with a choice between Morsi and Ahmed Shafiq, the candidate favored by the military; the final result was more a rejection of Shafiq than an endorsement of Morsi. The military probably recognized this, which is why it decided to respect the results.

But the generals have already moved to cut the Brotherhood down to size: just before last week’s election, the military dismissed parliament, following a decision by a constitutional court (whose members were appointed under the old regime) that the election law was unconstitutional. This sets up a future struggle between the Brotherhood and the military,