Ahmed Shafiq, Hosni Mubarak’s last prime minister, makes no apology for his service to a leader toppled by last year’s popular uprising. Now a presidential candidate himself, Shafiq has vowed to restore the security of the old order.

And as balloting began on Wednesday, the apparent resonance of that message has surfaced as the most remarkable element of Egypt’s first post-revolution presidential contest. While results may remain days away, most observers expect Shafiq to finish among the top tier of candidates, his popularity driven by weariness at unending protests, a faltering economy and sporadic violence, and by voters who want an alternative to the Islamists who already dominate parliament.

At his Cairo campaign headquarters on Wednesday, a video showed scenes of the chaos that has flared across Egypt during the past year and a half. They were interspersed with images of Shafiq when he was an air force officer, posing with Field Marshal Mohammed Hussein Tantawi, Mubarak’s longtime defense minister who, as head of a military council, has served for the past 15 months as the country’s de facto leader.

“Safety must return with full force,” declared a narrator as Shafiq, 70, stood nearby. “Society won’t stabilize without the full force of the state.”

The traction Shafiq has gained was clear among voters interviewed across the capital on Wednesday, and recent polls that show him finishing in first or second place in the first round of voting. In the neighborhood of Abbasiya in central Cairo, a group of 800 people went to the polls together to tick his name on the ballot.

But Shafiq is also a deeply polarizing figure, disliked and distrusted by those who say he represents a return to the corruption and repression of the past.

On Wednesday, dozens of young men waited outside a suburban Cairo polling station for Shafiq to cast his ballot. They held pictures of anti-Mubarak demonstrators who died last year in Tahrir Square.

“We want to deliver a message to the voters that this man killed these people,” said Mohammed Ibrahim, 21, blaming Shafiq for staying silent despite the deaths last year of nearly 1,000 Egyptian protesters. “I won’t let him become president. He doesn’t even recognize the revolution.”

When the candidate finally arrived, the angry crowd shouted “felool,” or remnants, a term used to describe holdovers from the old regime. And as Shafiq rushed back out of the school, young men threw shoes at him, mobbed him and shouted again, according to witnesses and video of the episode.

“Such irregular and chaotic behavior will not deter him from moving forward,” a statement from Shafiq’s campaign said. “This is caused by the high indicators of the vote in his direction.”

In an interview inside his office in central Cairo, a confident Shafiq portrayed himself as the only candidate who could counter the rise of political Islam. The once-repressed Muslim Brotherhood, whose members were tortured and imprisoned under Mubarak, now dominates Egypt’s parliament. Its presidential candidate, Mohammed Morsi, is also among the leading contenders.

“I think by experience I am able, 100 percent, to control this phenomenon,” Shafiq said, referring to the Brotherhood.

Shafiq is believed to have the backing of Tantawi and Egypt’s other military rulers, who have been resistant to reform and criticized for working to protect their own economic interests at the cost of democracy. State media also appear to be behind him, with frequent flattering commentaries and full-page ads in recent days appearing in state newspapers, despite an official ban on campaigning in the closing days of the contest.

If, as expected, no candidate wins a majority of the vote in the first round of balloting, the top two vote-getters will meet in a runoff next month. A victory by Shafiq would continue a tradition unbroken since a military coup in 1952 that has seen Egypt ruled by current or former military men. Some of those who took part in last year’s revolution have vowed to take to the streets again if Shafiq is victorious.

Addressing such threats, Shafiq said Wednesday that anyone considering a revolt would be “dreaming’’ if they believed it could oust an elected leader. He has said he would halt disruptive demonstrations if he is elected.

Shafiq has been unapologetic about his past and has defended comments he made in 2010 praising Mubarak as a role model and father figure.

“See what I said? And I will keep telling you this until the last day in my life, and for a reason: He had great courage,” Shafiq said in an interview on Al Haya channel this spring, referring to Mubarak.

Tamer Sami, 32, an electrician who voted in central Cairo, said he thinks Shafiq can stabilize Egypt after a year and a half of tumult.

“I want someone who will take us up, not start from the beginning,” Sami said. “I want someone who understands.”

At another polling station George Naguib, 37, said he was worried that if Shafiq won, people who see him as a Mubarak ally would take to the streets. “We need to respect this election and its results,” the accountant warned as he prepared to cast his ballot for Shafiq. “We need Shafiq to lead this country after everything we passed through.”

Special correspondent Ingy Hassieb contributed to this report.