His government signed the deal for a truce in the three-year civil war at a time when rebels are on the doorstep of the capital, Monrovia, kept from overrunning it only by fierce fighting with Taylor loyalists.
If Taylor follows through with the requirement he step down, he will likely face pressure to surrender for trial on charges he committed war crimes in neighboring Sierra Leone — just one of the regional wars he is accused of having a role in.
After the deal was signed, a spokesman for the U.N.-Sierra Leone war crimes court insisted Taylor still would have to face justice. "Whether he's president or not, he's indicted by the special court, so he should have his day in court," David Hecht said.
Taylor's defense minister, Daniel Chea, who signed the cease-fire in Ghana's capital, appeared to commit the Liberian leader personally to the deal.
"President Taylor fully supports this peace accord, and the government will do anything to ensure its success," Chea said. "We have done the greatest thing this afternoon by signing this cease-fire. By this, we're letting the world know that the government of Liberia wishes in no way to be part of any further bloodshed."
Mediators and observers in Accra burst into applause and raucous cheers as Chea shook hands with Kabineh Janeh and Tia Slanger, delegates of the two rebel movements that have seized more than 60 percent of the West African nation.
In Liberia, news of the cease-fire sparked celebrations in the streets of Monrovia. Cars, with white rags tied to their antennas in symbols of peace, drove through rutted roads, honking. Shoppers burst into dance at one roadside market.
It was not immediately clear if Monrovia's residents were aware of the accord's provision that Taylor resign. Earlier this month, rumors that Taylor had been arrested on his war crimes indictment set off panic in his capital — with residents fearing a bloody power struggle in his absence.
Last week, military helicopters evacuated Americans and Europeans from Liberia's besieged capital.
For Africa's oldest republic — founded in the 19th century by freed American slaves — Taylor has meant years of war. In 1989, he launched an insurrection with Libyan backing that plunged the nation into a 7-year civil war that killed at least 150,000 people.
He emerged from the civil war as Liberia's strongest warlord and won presidential elections the following year — elected in part by people who feared he would renew the war if he lost.
But the country saw only two years of peace before the latest rebellion erupted in 1999.
Since then, more than 1.3 million Liberians have been uprooted, hundreds of thousands have fled into neighboring countries. Rights groups say both sides in the war have killed, raped, robbed and kidnapped civilians.
The United States, the European Union, Nigeria and Ghana have pushed for an end to the conflict in Liberia. Representatives from all four signed Tuesday's agreement, as witnesses.
The accord, a copy of which was obtained by The Associated Press, calls for "formation of a transitional government, which will not include the current president."
The interim government, to include representatives of the country's rebels and political parties, would be formed within 30 days.
The U.N.-Sierra Leone court issued its indictment against Taylor only hours before the negotiations in Ghana began on June 4. Hours later, an emotional Taylor promised to surrender power in the interests of peace.
"If President Taylor is seen as a problem, then I will remove myself. I'm doing this because I'm tired of the people dying. I can no longer see this genocide in Liberia," he said at the time.
He then returned to Liberia — despite calls for Ghana to arrest him — and he has not repeated the promise. Last week, he insisted Liberia would have no peace unless the indictment was dropped.
To oversee the cease-fire deal, West African nations have discussed sending a 50-member verification mission, said Sony Ugoh, an official with the West African regional bloc that oversaw the talks.
That would be followed by a West African-led "stabilization force," Ugoh said, adding that the force could include unspecified American assistance.
Some 2 million people were killed or displaced by the war in Sierra Leone, in which Taylor allegedly supported the Revolutionary United Front rebels. Leaders of the RUF also face war crimes charges.