Central African Republic President Francois Bozize, the rebels who sought to overthrow him, and the political opposition have reached a deal to create a government of national unity.

Friday's agreement, which includes a ceasefire, also envisages the dissolution of the country's National Assemby and allows Bozize to stay in office until 2016.

The announcement came after several days of talks in Gabon's coastal capital, mediated by neighbouring central African nations, which were organised after an alliance of rebels groups swept through the north of the country seizing control of a dozen towns.

Bozize publicly shook hands with the rebel representatives and other political opponents.

The national unity pact includes a provision that a prime minister will be appointed from the country's political opposition, and legislative elections will be organised in a year, said Chadian Foreign Affairs Minister Moussa Faki Mahamat.

"The mandate of President Bozize is a constitutional question. We cannot challenge the Central African Republic's constitution," said Chadian President Idriss Deby, who presided over the closing ceremony for the talks.

Bozize seized power in 2003 after a rebellion, and later went on to win elections in 2005 and 2011, though the US and others have described the votes as deeply flawed.

The rebels, who began their offensive on December 10, had previously called for Bozize to step down from power and had dismissed his calls to form a national unity government.

Their offensive stopped short of the capital of Bangui but posed the gravest threat to Bozize during his nearly 10 years in power.

Source: Agencies