* Rebels agree to formation of unity government
* President Bozize vows not to stand for re-election
* Minerals-rich country hit by poverty, conflicts (Adds details, quotes)
LIBREVILLE, Jan 11 (Reuters) - Central African Republic's government and rebels agreed to the formation of a national unity government under a ceasefire deal on Friday to end an insurgency that swept to within striking distance of the capital.
The agreement, signed in Gabon's coastal capital after three days of negotiations under the intermediation of neighbouring central African states, also envisages the dissolution of the country's National Assembly.
"This is a good deal to bring peace," said Seleka spokesman Eric Massi by telephone. "But the ceasefire is contingent on several of our demands being met and we will judge Mr. Bozize's sincerity in the coming days."
The month-long rebellion had come to within 75 km (45 miles) of the riverside capital Bangui, posing the biggest threat yet to Bozize's decade in charge of the minerals-rich former French colony.
Central African Republic is one of a number of countries in the region where U.S. Special Forces are helping local soldiers track down the Lord's Resistance Army, a rebel group that has killed thousands of civilians across four nations.
Massi that said among the Seleka coalition's demands were the release of political prisoners and a revision of the constitution stripping the president of certain powers, including the right to fire his prime minister.
The rebels had previously insisted that Bozize's resignation was a precondition for peace and that the president, who came to power in a Chadian-backed 2003 coup, should stand trial at the International Criminal Court.
African leaders deployed hundreds of troops to the country to bolster its military against the rebels, who say Bozize reneged on a 2007 peace deal meant to provide jobs to insurgents who laid down their weapons.
Bozize's term runs out in 2016 and he has promised not to stand for re-election. (Reporting by Jean Rovys Dabany in Libreville; Additional reporting by Richard Valdmanis in Dakar; Writing by Daniel Flynn and Richard Valdmanis; Editing by Alison Williams)