* EU and Russia in tug of war over Ukraine and ex-Soviet republics
* Ukraine turns to Moscow, citing dire economic straits
* Future of EU trade deal with Kiev uncertain
By Justyna Pawlak and Adrian Croft
VILNIUS, Nov 29 Ukrainian President Viktor Yanukovich vetoed last-minute attempts by the European Union to rescue a trade deal that could have been signed at a summit on Friday and would have signalled a historic shift away from Russia, EU diplomats said.
Under pressure from Moscow, Yanukovich abandoned plans last week to sign the agreement, preferring closer ties with Ukraine's former Soviet master and dealing a blow to EU efforts to build closer relations with its eastern neighbours.
As EU leaders gathered in Vilnius on Thursday for a summit with six countries in eastern Europe and the southern Caucasus, officials from the EU and Ukraine tried to work out a last-minute compromise that could have allowed Yanukovich to sign the trade deal in the near future.
EU diplomats told Reuters a preliminary understanding had been reached, but Yanukovich had refused to sign off on it.
"I see this as a defeat for Ukraine," said President Dalia Grybauskaite of ex-Soviet Lithuania, host of the summit. "The current choice of the Ukrainian leadership means putting limits on the Ukrainian people's chances of achieving a better life."
German Chancellor Angela Merkel and French President Francois Hollande both blamed Yanukovich for the failure of the talks, but said the door remained open.
Donald Tusk, prime minister of Poland, one of Ukraine's neighbours, said that "history did not come to an end in Vilnius", and both sides would keep working on closer ties.
In comments reported on his website on Friday, Yanukovich said Ukraine still intended to sign the agreement in the future, but for now needed a financial aid package from the West to help its fragile economy move closer to the EU.
He said this should include macroeconomic assistance, re-establishing a working relationship with the International Monetary Fund and the World Bank on "acceptable terms", a review of EU limitations on some Ukrainian exports, and help with modernising Ukraine's vast gas pipeline network.
He had detailed Ukraine's economic woes to EU leaders on Thursday, citing the high prices it has to pay for Russian gas.
Yanukovich had also called an earlier EU offer of 600 million euros ($800 million) in aid "humiliating".
Merkel said the EU would re-export natural gas to Ukraine, which is dependent on Russia for its energy supplies, if Ukraine wanted it - although Europe's current ability to do so for long periods is limited.
European Commission President Jose Manuel Barroso said Ukraine's call for three-way talks on the trade pact between Ukraine, the EU and Russia was unacceptable.
"The times of limited sovereignty are over in Europe," he told a news conference after the summit.
Yanukovich's decision to walk away from the EU deal has brought thousands of protesters onto the streets of Kiev.
Silence fell over about 400 pro-Europe protesters in Kiev's Independence Square when news was announced from Vilnius that Ukraine had not signed the agreement. Demonstrators then began chanting "Coward! Coward!" - a reference to Yanukovich.
"I have no words," said Yuri Litonchenko, 29, wiping away tears. "I wanted our country to get out from under the thumb of the people running it."
By the end of the day, the numbers in the square, theatre of the Orange Revolution of 2004-5 that thwarted Yanukovich's first presidential bid, had swelled to nearly 10,000.
In a brief episode of violence late in the evening, at least four people were beaten by police, including a Reuters cameraman and a Reuters photographer, who was bloodied by blows to the head.
The scuffle occurred as police tried to remove passersby near Independence Square to clear a pro-EU demonstrator's vehicle from the road. Protesters instead crowded around the vehicle.
Earlier, some 3,000-4,000 Yanukovich supporters, many bussed in from his Russian-speaking strongholds in eastern Ukraine, took to a square 150 metres (500 feet) away to hail his move as a favour to Ukrainian producers.
Several Ukrainian opposition leaders, including former boxer Vitaly Klitschko, told a news conference in Vilnius that they would sign the agreement with the EU if elected.
EU leaders said a trade pact would boost Ukraine's economy by more than 6 percent and save Ukrainian business 500 million euros a year in import duties.
Having failed to include Ukraine's 46 million people in its project to build influence in eastern Europe and the southern Caucasus, the EU nevertheless initialled political association agreements with two other former Soviet republics: Georgia and Moldova. The pacts should be signed formally in around a year.
Ukraine, with its mineral riches, large land mass bordering four EU member states and annual output of more than $300 billion, is an attractive trading partner to both Moscow and Brussels.
However, it has heavy financing needs in the coming 18 months and must find more than $17 billion next year to meet gas bills and debt repayments.
Russia, keen to maintain its grip over the former Soviet republics that it considers part of its sphere of influence, wants Kiev to join the Russian-led trade bloc and had put heavy pressure on Yanukovich not to sign the pact with the EU.
In Thursday's lower-level talks, the EU offered technical help to meet conditions for IMF assistance, and suggested that new EU aid money could be put on the table.
Among its conditions for a deal, the EU had asked that Ukraine tackle the issue of "selective justice", an implicit demand that it address the fate of jailed former prime minister Yulia Tymoshenko, Yanukovich's rival. She declared a hunger strike on Monday over the failure to sign the agreement.