CAIRO The prospect of Ahmed Shafiq succeeding Hosni Mubarak as president of Egypt is a nightmare for revolutionaries and Islamists, but a security blanket for those wary of change.
Shafiq, who served briefly as Mubarak's last premier, is a divisive military figure who will contest next month's run-off vote for the presidency against the Muslim Brotherhood's Mohamed Mursi, according to a count by the Islamist group.
A Brotherhood official said Shafiq, a former air force commander, had come second to Mursi in the opening round of Egypt's first free presidential election this week.
He said that with most votes counted, Mursi had won 25 percent, Shafiq 23 percent, a rival Islamist Abdel Moneim Abol Fotouh 20 percent and leftist Hamdeen Sabahy 19 percent. The two top candidates will contest a run-off on June 16 and 17.
The bluff, straight-talking Shafiq came from behind in a race in which Amr Moussa, former head of the Arab League, and ex-Brotherhood member Aboul Fotouh were early favorite.
His late surge reflected the anxiety of many Egyptians about a breakdown of law and order and the often violent political disputes that have punctuated an army-led transition since a popular revolt ousted Mubarak on February 11, 2011.
It also rested on the fear, not least among Egypt's 10 percent Christian minority, of rising Islamist power.
Less easy to determine is the extent to which Shafiq relied on the networks of Mubarak's now-banned National Democratic Party or on the influence of the military from which he sprang.
Parliament, dominated by the Muslim Brotherhood and other Islamists repressed under Mubarak, had sought to bar Shafiq from the race with a law disqualifying senior officials of the old administration. But the election committee, headed by a former military officer, conditionally upheld Shafiq's appeal.
Many Shafiq supporters come not from the political hotbed of Cairo and other cities, but from the countryside, where voter concerns about security and order tend to be strongest.
His staunchest opponents are already threatening to take to the streets in protest if he becomes president.
Shafiq, who favors open-necked shirts under the blazers or sweaters he wears in public, has vowed to uphold Egypt's 1979 peace treaty with Israel, saying: "I object to Israel's current actions, but I am a man who honors past agreements."
He says he has the military and political experience to lead Egypt into a new democratic era, yet his links to Mubarak have polarized voters. He sees himself as slotting into Egypt's 60-year-old tradition of drawing presidents from the military.
"You cannot suddenly bring a civilian man with no relation or knowledge of military life and make him president and supreme commander of the armed forces," Shafiq told Reuters earlier this year, saying he could ensure a "smooth transition".
The military council that took over from Mubarak has promised to hand over to a new president by July, but the army is expected to wield political influence for years to come.
"Civilians may be in a hurry and they think that as soon as the new president is elected he will act freely of the military. No, this will not be the case," Shafiq, 70, declared.
But the idea of Shafiq taking power enrages many Egyptians who see him as a tool of the army and the Mubarak old guard who would roll back all the uprising's fragile gains.
Protesters threw stones and shoes at him when he voted in Cairo on Wednesday. "The coward is here. The criminal is here!" they chanted. "Down with military rule!" Shafiq was unhurt.
He makes no secret of his "good relations" with army chief Field Marshal Mohamed Hussein Tantawi, saying he had consulted him before deciding whether to run. He did not disclose what advice Tantawi, who is also defense minister, had offered.
Shafiq has openly expressed his admiration for Mubarak, making no apologies for describing the former president as his role model, after his own father, in a 2010 newspaper interview.
"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 told al-Hayat television when queried about the remark.
Mubarak named Shafiq prime minister in a last-ditch attempt to placate protesters. A few days later the president stepped down. Shafiq lasted another three weeks before he too resigned.
Shafiq has publicly expressed regret about the success of the anti-Mubarak "revolution".
In a military career spanning four decades, Shafiq served in wars with Israel and is credited with shooting down an Israeli aircraft in the 1973 war.
When he led the air force in the 1990s, Shafiq sought to modernize it with more advanced weapons. Some Egyptian officials say Washington, which gives Egypt $1.3 billion a year in military aid, opposed some plans because of Israeli objections.
As civil aviation minister from 2002 to 2011, he overhauled state airline EgyptAir and improved the country's airports.
(Editing by Alistair Lyon)