By Phil Black. Nick Paton Walsh and Michael Pearson, CNN
KIEV, Ukraine (CNN) — Ukraine’s President and opposition leaders agreed Friday to a deal meant to end the country’s political crisis and bloody fighting that has left parts of Kiev a war zone.
President Viktor Yanukovych, opposition leaders and representatives of the European Union signed the deal Friday afternoon after a night of difficult negotiations that stretched well into the day.
“Good compromise for Ukraine. Gives peace a chance. Opens the way to reform and to Europe,” Polish Foreign Minister Radoslaw Sikorski said via Twitter before the signing was completed.
Earlier, an ITN/ITV camera captured Sikorski telling a protest leader to accept the deal.
“If you don’t support this, you’ll have martial law, you’ll have the army. You will all be dead,” he can be overheard as saying.
A cheer went up from the crowd in Kiev’s Independence Square when the agreement was announced. Protesters waved Ukrainian flags under clear skies free of the choking smoke from burning barricades that has characterized recent days.
But it remained to be seen if the deal would be enough to overcome the nation’s deep divisions and mistrust on both sides inflamed by the recent violence.
Ukraine’s parliament moved quickly to fulfill the first requirement of the agreement — passing a law to roll back the country’s constitution to an earlier version that limits the President’s powers.
The deal calls for further constitutional reform to be completed by September, according to a draft posted on the German Foreign Office’s website.
It also requires presidential elections “as soon as the new Constitution is adopted but no later than December 2014.”
And protesters are to withdraw from streets and public buildings they’ve occupied during the crisis and turn in illegal weapons, according to the deal.
Security forces are to “step back from confrontational posture” and use force only to protect public buildings, the agreement says.
A joint investigation into the recent violence will follow. Authorities, opposition representatives and the European Council will be included, according to the deal.
White House spokesman Jay Carney said the United States welcomed the agreement but said it would closely watch to make sure it is implemented.
Reaction to the signing from opposition leaders wasn’t immediately available.
Earlier, opposition leader and former boxer Vitali Klitschko said protesters must keep the pressure on the government.
“We must do everything to stop the confrontation, and the people who gave illegal orders will be brought to justice,” he said.
While developments appeared encouraging, an earlier fragile truce crumbled just a day before amid renewed fighting. Geoffrey Pyatt, U.S. ambassador to Ukraine, called the result Thursday “the most tragic day in the history of Ukraine.”
The crisis began in November with anger about Yanukovych’s decision to scrap a European Union-oriented trade deal and turn toward Russia.
It escalated this week with fierce fighting that the government says has claimed 77 lives and drew swift rebuke from the West. Protesters put the death toll at about 128.
The country has long been divided between historic allegiances to Russia in the east and Europe in the west.
But the disagreement quickly escalated into anger about Yanukovych’s rule, including a sweeping, if short-lived, anti-protest law enacted in January.
Russia, which has offered to lend money to cash-strapped Ukraine in a deal worth billions of dollars and lower its gas prices, has put pressure on Yanukovych to crack down on demonstrators.
Western leaders, who have offered Ukraine a more long-term aid package requiring economic modernization, have urged the President to show restraint, allow the opposition more access to government and let the democratic process work out amid deep political differences.
The crisis boiled over Tuesday when security forces waded into the crowd with water cannons, stun grenades, nightsticks and armored personnel carriers. That fighting brought swift condemnation from Western leaders, who accused Ukrainian leaders of a bloody crackdown.
Ukrainian officials, however, blamed protesters for attacking police, invading government buildings and looting hundreds of guns and tens of thousands of rounds of ammunition.
Government officials declared a truce Wednesday, but that cease-fire failed early the next day when fighting broke out again. In Thursday’s round of fighting, some protesters appeared to be armed. Men in what appeared to be government uniforms seemed to fight back with automatic weapons and at least one sniper rifle.
In one incident captured by a CNN camera crew, gunfire felled a protest medic trying to treat a man lying on the ground.
One doctor treating protesters said several people had died of targeted wounds that she said appeared to be from sniper shots.
CNN was not able to immediately confirm the claims.
The government acknowledged Thursday that its forces had used firearms, saying it had done so to protect unarmed police officers who were in danger.
The European Union and United States responded to this week’s violence with sanctions against Ukrainians deemed responsible for the violence.
CNN’s Nick Paton Walsh, Phil Black, Andrew Carey, Alla Eshchenko and Todd Baxter reported from Kiev, and CNN’s Michael Pearson reported and wrote from Atlanta. CNN’s Ben Brumfield, Jessica King, Zahra Ulah, Mark Thompson and Greg Botelho also contributed to this report.