Updated

The Muslim Brotherhood is scrambling to broaden its appeal to liberals, leftists and Christians after official results Monday showed that the Islamist group's candidate will face ousted autocrat Hosni Mubarak's last prime minister in next month's runoff for president of Egypt.

Violence flared late Monday when several hundred people ransacked the Cairo campaign headquarters of the ex-premier, Ahmed Shafiq. They smashed windows, threw out campaign signs, tore up posters and set the building on fire, according to witnesses and security. No one was hurt. The office is in a Cairo residential neighborhood.

The Brotherhood's candidate, Mohammed Morsi, will go head-to-head against Shafiq, also a former air force commander, in the June 16-17 runoff. They were the top vote-getters in last week's first round of voting.

Announcing the final results, election commission chief Farouq Sultan said that Morsi won close to 5.8 million votes, or almost 25 percent, while Shafiq garnered 5.5 million votes, or nearly 24 percent. Finishing third was leftist candidate Hamdeen Sabahi with 4.8 million votes, or about 21 percent.

To get the support it needs, the Brotherhood must tone down its religious rhetoric and offer far-reaching concessions, such as protecting the right to protest and strike, election-watchers said.

None of the 13 candidates had been expected to get the more than 50 percent of the vote needed to win outright. Still, Morsi's top finish was a surprisingly strong showing, because he was widely viewed as a weak candidate and because the Brotherhood's popularity has eroded recently because of a series of missteps.

Soon after the election commission announced the results, several hundred Sabahi supporters gathered in Cairo's Tahrir Square, the birthplace of last year's uprising, chanting slogans against the military, Morsi and Shafiq. Similar numbers gathered in the Mediterranean port city of Alexandria, where some of the protesters tore down a large Shafiq poster.

Turnout among the country's 50 million registered voters was more than 46 percent, Sultan said.

Shafiq is widely viewed as an extension of the Mubarak regime, and the Morsi-Shafiq runoff is the most polarizing contest possible. In many ways, it mirrors the conflict between Mubarak, himself a career air force officer like Shafiq, and the Islamists he jailed and tortured throughout his years in power.

For Morsi to win, said Khaled Abdel-Hameed, one of the leaders of last year's 18-day uprising against Mubarak, he must make concrete concessions on specific issues.

"A protest boycott of the election is an option," said Abdel-Hameed. "If not, we want Morsi to adopt a package of legislation guaranteeing freedoms, labor union activity and the right to strike and protest."

The U.S.-educated Morsi appears willing to broaden his appeal but has offered few specifics.

He has vowed to be a "president for all Egyptians" — a nod to minority Christians who voted overwhelmingly for Shafiq. He has pledged to work to realize the goals of the revolution, a promise designed to appease the pro-democracy youth groups behind the uprising that toppled Mubarak. And he has pledged a national unity government.

"We are certain that the remnants of Mubarak's regime and his gang, and those that belong to it that are trying to bring back the former regime will fall flat and will land in the garbage bin of history," he said.

Morsi's success, said Middle East expert Shadi Hamid of the Brookings Institution in Doha, Qatar, depends on how explicit and concrete the Brotherhood promises will be and whether the group can reassure significant segments of the population that view it as opportunist and hungry for power.

Pro-democracy activists say that the Brotherhood did not join their 2011 anti-Mubarak uprising until it became clear it had irreversible momentum and that it later abandoned them during their protests against military rule so as not to lose the goodwill of the generals who took over from Mubarak.

But the alternative — Shafiq — will be hard for them to accept.

"Leftists and liberals can hold their noses and vote for Morsi," Hamid said. "The Muslim Brotherhood is moving to the center and not everyone who did not vote for Morsi in the first round was actually voting against him."

The Brotherhood was empowered by the ouster of Mubarak 15 months ago, emerging as the nation's most dominant political force after spending the best part of nearly 60 years as an illegal, underground organization. It went on to win just under half of all seats in Parliament.

But it has failed to translate its dominance in the legislature into real political power, partly because the generals wield near-absolute authority, and also because of the perceived poor performance of its lawmakers.

Its credibility took a hit when it reversed an earlier decision not to field a candidate in the presidential election. Later, it attempted to pack a 100-member panel assigned to draft the constitution with its own lawmakers and other Islamists.

Khalil el-Anani, an expert on Islamic groups from Britain's Durham University, said the Brotherhood needs to change its thinking and cast aside the "persecuted" approach left over from years in the political wilderness.

"They don't realize that things have changed around them," he said. "In order for him to win, Morsi must reinvent himself as a nonpartisan politician."