Al Jazeera's Beirut correspondent, Rula Amin, said from Doha that the agreement was a major breakthrough as the talks had appeared to be breaking down just hours earlier.

 

She said Sheikh Hamad bin Khalifa Al Thani, the Qatari emir, was still at the Sheraton hotel in the early hours of Wednesday, working with the rival Lebanese groups on the final wording of the declaration.

 

New president

 

Delegates are said to have reached a deal on electing Lebanon's new president.

 
The two sides agreed on General Michel Suleiman, the head of the army, as a consensus candidate to succeed Emile Lahoud, the former president, who stood down at the end of his term in November.
 

Suleiman had appeared to be closer to the government coalition when he was first nominated but he was recently criticised as being too close to the opposition when his troops did not intervene when gun battles broke out between the warring sides this month.

 

Lebanon has been without a president since Lahoud stepped down owing to differences between the majority and opposition over the makeup of a new unity government and proposed changes to the electoral law.
 
Veto power
 
But the government and opposition now appear to have agreed on the allocation of cabinet seats to form a new unity government that will give crucial veto power to the opposition, something that has been a key sticking point.

 

The opposition got 11 out of 30 cabinet seats, our correspondent reported, meaning it can block any government decision it does not agree with.

 

And the two sides are also thought to have resolved a dispute over a parliamentary law for elections to be held next spring.

 

The changes to the electoral law gave Saad al-Hariri, the leader of the majority bloc in government, most of what he had asked for, our correspondent reported.

 

Hezbollah weapons

 
Earlier, Tareq Mitri, Lebanon's acting foreign minister, had accused the Hezbollah-led opposition of showing insufficient respect for the efforts of the Qatari mediators to find a compromise.
 
Political deadlock

Background to Lebanon's power vacuum

Who's who in Lebanese politics
Samir Geagea, a prominent Christian leader in the majority bloc, said the dialogue had been dealt a "heavy blow" by the opposition.
 
He accused it of taking "matters back to square one".
 
Qatar had proposed including a clause in the final statement of the talks, requiring all sides to denounce any resort to armed violence in internal Lebanese disputes.
 
Disagreements between the two sides over Hezbollah's weapons have proved an additional stumbling block in the talks.
 
The government representatives have insisted that Hezbollah's arms be on the agenda for the talks in Qatar, but Hezbollah's delegates said earlier this week that the issue is "not up for discussion".

Attempting a compromise, Akram Shehaieb, a Druze member of parliament, said the pro-government bloc wanted to address only the issue of the weapons used "against the Lebanese people in Beirut and the mountains" in recent clashes.

"The weaponry of the resistance is a Lebanese issue which will be debated in a [subsequent] dialogue led by the president in Lebanon," he said.
 
Hezbollah's weapons are a sore point in Lebanon. Most armed groups voluntarily disarmed after Lebanon's 1975-1990 civil war, but Hezbollah was allowed to keep its arms to resist Israel and has since built up a huge arsenal.
 
The Qatar-hosted talks follow an Arab-mediated deal that brought an end to a week of fighting, prompted by government moves to ban Hezbollah's private communications network and sack the security chief at Beirut airport, who was alleged to have ties to Hezbollah.