KIEV, Ukraine — President Viktor Yanukovych signed a deal with Ukraine's opposition leaders on Friday brokered to end the deadly violence that put the country on the brink of civil war.
He agreed to early elections and to surrender some of his powers after 77 people were killed as a geopolitical tug-of-war over whether Ukraine should embrace the West or Russia turned violent this week.
"I announce the steps that should be made to restore peace and to avoid further victims of the stand-off," Yanukovych said in a statement addressed to "compatriots" outlining several concessions to opponents.
He also backed a return to the 2004 constitution, which further limits presidential powers in favor of the parliament, and agreed to form a "government of national confidence" in the wake of this week's clashes.
Holding early presidential elections had been a key demand of opposition leader and former heavyweight boxing champion Vitali Klitchsko.
"In these tragic days when Ukraine suffered such grave losses, when people on both sides of barricades have died, I consider it my obligation to the memory of the deceased to state that there is nothing more important then a human life," Yanukovych added.
The agreement came after overnight negotiations with opposition leaders, European Union ministers and Russia.
Poland's Foreign Minister Radosław Sikorski, who helped broker the deal between the president and activists camped at Kiev's Independence Square, said it was a "good compromise."
Sikorski was also filmed by Britain's ITV News telling an opposition leader: "If you don't support this [deal] you'll have martial law, you'll have the army. You will all be dead."
A Reuters journalist who attended the signing said Yanukovich did not smile during a ceremony that lasted several minutes.
Earlier, local TV reported that opposition leaders had left the parliament building to discuss the situation with demonstrators in Kiev's Independence Square.
Thousands of people peacefully gathered in the square Friday morning to watch a live feed of a parliamentary meeting. Protest leaders urged their comrades not to fight -- and to not advance toward government forces.
Speaking before the deal was signed, GlobalPost journalist Christopher Miller told NBC News that many protesters were "reinforcing barricades."
Dozens of officers from the western city of Lviv also arrived in Kiev and declared themselves on the side of the opposition. Lviv itself was the scene of protest on Thursday as hundreds of demonstrators stormed police stations and interior ministry buildings.
But while footage from the square showed calm, Ukraine's interior ministry released a statement accusing anti-government protesters of opening fire on police in nearby streets at 10:15 a.m. local time (3:15 a.m. ET). The account could not be independently verified by NBC News.
On Thursday, Klitschko backed a resolution passed by Ukrainian lawmakers that prohibited the use of weapons against civilians and ordered any troops stationed in Kiev to return to their barracks.
"This is a very small step, but it paves the way forward. This resolution shall take effect immediately after the adoption. Most important for us was to stop the bloodshed," Klitschko said.
The mood among lawmakers remained tense however, with a scuffle in Thursday's session followed up by a failure by some politicians to observe a minute's silence for the dead on Friday morning.
Thursday saw protesters armed with makeshift riot shields, helmets and Molotov cocktails resume their bloody battle with riot police for control of Independence Square - known as the Maidan.
Parts of the city were turned into an urban battleground with burning barricades and fierce battles resuming between security forces and civilians. Video appeared to show police snipers firing at unarmed protesters.
At least 77 people have been killed this week - including more than 13 police officers - and 577 others were injured. Thursday was Ukraine's bloodiest day since the country emerged from the Soviet Union in 1991.
Protests kicked off in November after Yanukovych shelved an association agreement with the European Union in favor of closer ties with Russia. Russia then announced a $15 billion bailout for Ukraine, whose economy is in tatters.
The demonstrations began peacefully but have increasingly involved extremists — including many aligned with the far right — who have clashed with riot police.
Moscow has branded clashes between anti-government protesters and Ukrainian security forces as an "attempted coup."
—Maria Stromova reported from Moscow for NBC News. Jason Cumming and Alexander Smith reported from London. Alex Furman, Peter Jeary and Albina Kovalyova of NBC News, The Associated Press and Reuters contributed to this report.