Kiev, Ukraine (CNN) -- Ukraine's President and opposition leaders agreed Friday to a deal meant to end the country's political crisis and end bloody fighting that has left parts of the 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 on Twitter before the signing was completed.
It escalated this week with fierce fighting that the government says has claimed 78 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 complete 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 the streets and turn in any weapons within 24 hours.
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. U.S. Ambassador to Ukraine Geoffrey Pyatt called the result Thursday "the most tragic day in the history of Ukraine."
Still, a buoyant mood pervaded Independence Square, known in Kiev as Maidan, on Friday afternoon. Protesters waved Ukrainian flags under clear skies free of the choking smoke from burning barricades that has characterized recent days.
The scene was less tranquil in Ukraine's parliament, where a scuffle broke out while lawmakers were in session.
Dozens of police officers that had surrounded the building pulled back Friday afternoon. It was unclear what the pullback meant.
Ukraine's crisis began in last year, when protesters angry about Yanukovych's decision to scrap a trade deal with the European Union and instead accept more immediate aid from Russia angered many Ukrainians.
The country's population 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 on 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 Thursday when fighting broke out again. In that round of fighting, some protesters appeared to be armed. Men in what appeared to be government uniforms appeared 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 did acknowledge 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.