By Phil Black. Nick Paton Walsh and Michael Pearson
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’s city center 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.
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.
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 agreement gives the government 48 hours to restore an earlier version of the country’s constitution limiting the president’s powers and calls for further constitutional reform to be completed by September, according to a draft posted on the German Foreign Office’s website.
The deal also calls for presidential elections “as soon as the new Constitution is adopted but no later than December 2014.”
It calls for protesters 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.
Reaction 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 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 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 deep political differences.
The crisis boiled over Tuesday when security forces waded into the crowd with water cannons, stun grenades, night sticks and armored personnel carriers. In the fighting that ensued, 28 people died, drawing 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.
The government acknowledged Thursday that its forces had used firearms, saying it had done so to protect unarmed police officers who were in danger.
CNN was not able to immediately confirm the claims.
Protesters said about 100 people died Thursday.
Ukraine’s Health Ministry put the toll much lower. It said that 77 people have died since clashes broke out Tuesday and that 577 people had been injured.
The European Union and United States responded 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.
™ & © 2014 Cable News Network, Inc., a Time Warner Company. All rights reserved.