A political crisis in the Ukraine appears to have been averted - at least for now - with the announcement that parliamentary elections are set to be held in September.
The agreement follows a mounting stand-off between President Viktor Yushchenko, a pro-Western liberal, and Prime Minister Viktor Yanukovych, whose supporters favour closer ties with Russia.
Here we examine the background to the crisis.
Will elections solve the crisis?
Supporters of the president and prime minister certainly say so, as they turn their attention to gearing up for the election itself. But parliament still needs to approve the election timetable, and there are plenty of other grounds for disagreement. Some analysts say the two rivals' differences underline deeper splits in the country, which even elections may not be able to resolve.
What triggered the latest war of words?
President Yushchenko decided to dismiss the prosecutor general, Svyatoslav Piskun, an ally of the prime minister. That led to a dramatic storming of the prosecutor general's office on 24 May by riot police and Interior Minister Vasyl Tsushko, who claimed the president was usurping power.
President Yushchenko hit back by placing the 40,000 interior ministry troops under his direct command. Prime Minister Yanukovych then condemned his action, saying it violated the constitution. The interior ministry said it would defy the president's order.
What are the longer-term causes?
President Yushchenko dissolved parliament on 2 April and called early elections. Tensions have been running high since then, with Mr Yanukovych and his allies disputing the president's authority to do so.
At one stage, the two leaders announced they had reached a compromise - but MPs who stand to lose from early elections said they would not support it. So the political system has been paralysed by arguments over who has authority to do what.
Ukraine's constitution provides for a presidential political system, but successive legislation has transferred many powers to the prime minister and parliament. This has led to a legal quagmire, with electoral law, the constitution and parliamentary standing orders contradicting each other.
Mr Yanukovych has built a majority in parliament, with the help of communists and socialists. But Mr Yushchenko has accused him of poaching parliamentary deputies from other blocs, in violation of the constitution. He says the constitution only allows whole parliamentary blocs to change sides, not individuals.
Mr Yanukovych currently controls about 250 seats in parliament. If he were to reach 300, he could reject presidential vetoes, vote through changes to the constitution, and impeach the president.
Has the president the power to dissolve parliament?
The constitution lists three situations in which the president has the right to dissolve parliament, and the poaching of deputies is not among them. On the other hand, it does say presidential decrees must be fulfilled.
Constitutional reforms carried out as a result of the Orange Revolution weakened the president and strengthened parliament - but Mr Yushchenko and Mr Yanukovych have clashed over the details.
So who will win the elections?
21 Nov 04 Yanukovych declared winner of presidential election - protests begin
3 Dec 04 Election annulled
11 Jan 05 Yushchenko declared winner of re-run election
8 Sep 05 Yushchenko sacks Tymoshenko government
26 Mar 06 Yanukovych party wins most votes in general election
3 Aug 06 After four-month deadlock, Yushchenko agrees Yanukovych can be PM
2 Apr 07 Yushchenko issues decree dissolving parliament
It is quite possible that Mr Yanukovych's party will be returned again as the largest party, in which case little would have changed. The only other leader with a chance of leading a parliamentary majority after the election is Mr Yushchenko's Orange Revolution ally, Yulia Tymoshenko.
She and Mr Yushchenko fell out when he sacked her as prime minister in September 2005. They are now on the same side again, but it is not clear how strong the relationship is.
Can the constitutional court resolve the problem?
In theory, yes. One of the encouraging things about this crisis is that both sides justify their actions in terms of the law and the constitution, so they ought to obey court rulings.
On the other hand, both sides have already made appeals to the court over the last eight months, and the court has yet to rule on a single case. So the court may not provide a quick way out.
Could the political course once again be determined by mass protests?
This seems unlikely. Mass street protests occurred in 2004, as a result of years of frustration bottled up during the presidency of Leonid Kuchma. As the protests gathered strength, euphoria swept through the pro-Western part of the population that was most hungry for change. These same people are now mostly deeply disillusioned by the last two years of political compromises and internal bickering.
Mr Yanukovych's supporters are hampered by the fact that their power base is in the east of the country rather than in the capital, Kiev.
Could the country split?
This is always a worry in Ukraine when politicians seen as pro-Western (Mr Yushchenko) and pro-Russian (Mr Yanukovych) are in conflict with one another.
It is broadly true that the west of the country is pro-European and the east is pro-Russian. However, Mr Yanukovych has not been militantly pro-Russian as prime minister. He even intervened to stop regions in the east of the country unilaterally introducing Russian as a second state language - even though upgrading the status of the Russian language was one of his manifesto pledges.
Does this crisis matter to the wider world?
Any kind of armed conflict in Ukraine would bring with it the risk of a Russian intervention, which would cause major east-west tensions.
A long-running political stand-off could paralyse the country, but would probably not have many repercussions overseas. Russia was unhappy about what it regarded as Western interference in the Orange Revolution, and the West was critical of Russia's open support for Mr Yanukovych, but relations were not seriously affected.
The main pipeline delivering Russian gas to Europe passes through Ukraine, but there would not appear to be any threat to supplies at present.