The people of Guinea have broadly welcomed a decision by their military rulers to keep Moussa Dadis Camara, the country's wounded chief, in temporary exile.
The deal, which was signed by Camara on Friday, eased concerns of further violence in Guinea, leaving his deputy and an opposition leader to restore civilian rule.
Mamadou Bah Baddiko, head of the UFD opposition group, said: "This is a very important development which is making things look up for the country.
"The priorities now need to be getting a grip of the state, winning the confidence of the population and ... putting the electoral process back on track," he said.
The signing ceremony was held in neighbouring Burkina Faso where Camara is recuperating from a botched assassination attempt by his aid-de-camp on December 3.
Since the assassination attempt, General Sekouba Konate, Camara's second-in-command, has served as Guinea's interim leader and initiated steps to return the country to civilian rule, with the support of the US and France.
A statement following the lengthy talks between Camara, Konate and Blaise Compaore, the president of Burkina Faso, said that Camara was "willingly taking a period of convalescence".
However, he "will remain available to help the players in the transition".
The pact leaves Bah Baddiko and General Konate in charge of establishing an interim government and elections in six months in the pact.
The pact also stated that no member of the military government, nor anyone in active military service, would be allowed to run in the civilian elections.
According to Friday's agreement, the new transition would be led by a religious personality and a prime minister will be appointed by the country's opposition.
Guinea's coalition of opposition and civil society groups proposed Jean Marie Dore, their spokesman, or Rabiatou Serah Diallo, a union leader, for the job of prime minister, the opposition said on Friday.
"Konate has taken meaningful steps to ensure that Guineans will have the chance to choose their leaders without fear"
Human Rights Watch
Known as the Forces Vives, the opposition want Konate to make the final decision over who will lead a government of transition tasked with holding elections and overseeing the return to civilian rule.
Camara's stay in Burkina Faso has been accompanied by mixed messages from the military government in Guinea.
Konate had said that Camara would not be allowed to return, but a delegation arrived Ouagadougou on Thursday to take him home.
Andrew Simmons, Al Jazeera's Africa correspondent, said: "Camara, who has been in Morocco since the attempt on his life, was taken onto a plane and according to him he was expecting to be coming back to Guinea.
"But the plane landed in Burkina Faso, in Ouagadougou [the capital], and he was extremely angry.
"General Konate then went to Ouagadougou for talks with him and there was a very angry exchange. After that, a group from the junta in Guinea made a televised broadcast saying they wanted their leader to come back.
"Talks then went on, over the last 48 hours, in which Camara had agreed not to come back to the country and that Guinea would continue along a road back to some kind of democracy," Simmons said.
Friday's signing of the agreement was the first time that Camara had appeared in public since he was shot in the head by a former aide and he appeared gaunt with a visible scar on the side of his head.
Camara seized power following the death of Lasana Conte, the president, in December 2008.
He promised to hold elections within the year and address rampant corruption in the desperately poor country.
However, suggestions that Camara did not intend to step down sparked public protests which culiminated in a brutal crackdown by the presidential guard on one demonstration in the capital Conakry.
"Dadis has been heavily implicated in the September violence in which more than 150 people were gunned down," Corinne Dufka, a senior researcher for US-based Human Rights Watch, said.
"Konate has taken meaningful steps to ensure that Guineans will have the chance to choose their leaders without fear. If Dadis returns this process will be in danger and may lead to further bloodshed."