A deal to end the crisis in Ukraine has taken a major step forward after protesters agreed to a compromise by the president to form a coalition government.
Opposition leader Oleh Tyahnybok said a council representing protesters in Independence Square backed the deal on condition that the current interior minister and prosecutor-general are excluded from any interim government.
The protesters' refusal to agree had formed a major obstacle in getting the deal signed.
The three opposition leaders - Mr Tyahnybok, Vitali Klitschko and Arseniy Yatsenyuk - met with President Viktor Yanukovych at the presidential HQ in Kiev to sign the deal.
In a statement on his website, Mr Yanukovych announced presidential elections would take place this year and promised to form a coalition government. The elections had been due to take place in March 2015.
He also promised to revert to the country's 2004 constitution which will trim presidential powers - one of the key demands of protesters.
"There are no steps that we should not take to restore peace in Ukraine. I announce that I am initiating early elections," he said.
The interior minister, Vitali Zakharchenko, was later removed following a vote in parliament. He was widely blamed for ordering police violence against protesters.
The parliament also voted to free jailed opposition figure Yulia Tymoshenko.
Opposition figures later took to the stage in Independence Square to detail the deal to the assembled crowds.
The White House has welcomed the deal, but said it remains prepared to impose additional sanctions.
President Barack Obama spoke to Russian president Vladimir Putin on Friday evening, with the two leaders discussing the need to stabilise Ukraine's economy and carry out reforms.
British Foreign Secretary William Hague said the agreement was an "important first step".
EU foreign minister Baroness Ashton said Mr Yanukovych had staked himself on the deal. She added that political stability and economic stability in Ukraine go "hand in hand".
European Union ministers became involved in brokering apolitical settlement in Ukraine after gun battles between police and anti-government protesters brought the death toll to 77 in two days.
The officials from Germany, France and Poland, embarked on "a night of difficult negotiations" with President Yanukovych and the opposition.
Poland's Foreign Minister Radoslaw Sikorski tweeted: "Good compromise for Ukraine. Gives peace a chance. Opens the way to reform and to Europe. Poland and EU support it."
British Prime Minister David Cameron welcomed the agreement in Kiev.
In a statement, he said: "I welcome today's agreement which offers a real chance to end the bloodshed and to stop the downward spiral into the nightmare that is facing Ukraine and her people.
"It should foster a lasting political solution to the crisis and President Yanukovych, his administration and the opposition must all get behind this deal and deliver it according to the timetable set out."
EU foreign ministers meeting in Brussels agreed to impose sanctions on officials held responsible for the violence on Thursday night, including a travel ban and asset freeze on close allies of Mr Yanukovych.
It came as Standard & Poor's rating agency lowered Ukraine's long-term rating a notch to "CCC", saying the political crisis has put the government's ability to service its debt at risk and raised uncertainty over Russia providing promised aid.
Violence flared again on Friday with reports of gunfire in the capital. Ukrainian police claimed protesters had opened fire on officers near Independence Square and they had returned fire.
A police statement said: "Participants in the mass disorder opened fire on police officers and tried to burst through in the direction of the parliament building."
Armed police entered the parliament building while politicians were holding an emergency session but were forced out, according to opposition leader Mr Yatsenyuk.
MPs then exchanged punches when speaker Volodymyr Rybak tried to adjourn the proceedings.
Police officers from regions in western Ukraine - including Lviv - joined the protesters on Friday to demonstrate against Mr Yanukovych.
One police captain from Kamenka-Buska, a village in the Lviv region, said: "Earlier we expressed support four our compatriots by sending a letter, saying the police are with the people.
"That was verbal support. Now we want to provide real support and help people in the way we can."
The protests started last November over Mr Yanukovych's decision to have closer ties with Russia rather than Europe.
Moscow then promised to provide a $15bn bailout and to slash prices that Kiev pays for energy supplies. The first $3bn tranche of that aid was paid at the end of January and Russia has promised to release the second instalment this week.
The fresh violence came after Mr Yanukovych announced a truce with the opposition after violent clashes with riot police killed at least 26 people on Wednesday.
Russia has warned Ukraine's President not to let opponents walk over him "like a doormat", in a strong signal that Moscow wants order on the streets before handing over extra cash to stave off bankruptcy.