Turkey's top court narrowly voted against disbanding the ruling party over accusations it is plotting to impose Islamic rule, but the judges cut off millions of dollars in state aid to a party locked in a power struggle with the secular elite. The decision Wednesday averted political chaos, at least in the short term, for a country seeking to join the European Union. But the case exposed the vulnerabilities of Western-style democracy in Turkey, where the fate of an Islamic-oriented governing party with strong electoral backing lay in the hands of a panel of 11 judges. The Constitutional Court delivered a strong - though unspecified - warning to the ruling Justice and Development Party in its decision to deprive it of half of its state funding. The party will lose about $15 million this year. "It is a serious warning," court chairman Hasim Kilic said. "I hope that this outcome will be assessed and that the necessary measures will be taken." Kilic said six of the 11 judges wanted to dissolve the party of Prime Minister Recep Tayyip Erdogan, one less than the seven votes needed to impose a ban. "The fact that there wasn't unanimity among the judges reflects the divisions that we have in society concerning the party," said Omer Faruk Genckaya, an analyst at Bilkent University in Ankara, the capital. The decision represented a reprieve for Erdogan and his allies in an overwhelmingly Muslim country with a secular system. A ban on the party would have triggered a sharp escalation in political turmoil in the NATO member, where a bomb attack Sunday killed 17 people in Istanbul. A ban would have severely damaged Turkey's image as a democracy because the ruling party won a landslide victory in elections last year. EU leaders had said the ruling party's viability should be decided in elections, not courtrooms. "The great uncertainty that was blocking Turkey's path has been lifted with this decision," Erdogan said after the verdict. "Our party, which was never the focal point of anti-secular activity, will continue from now on to defend the republic's basic values." European leaders voiced relief at the ruling and urged Turkey to press ahead with EU-backed reforms that have languished, partly because of the political infighting and partly from Turkish skepticism about the need for changes. "It needs a new civil and democratic constitution as soon as possible. The articles of the Turkish constitution that allow closing down political parties should be changed immediately," said Joost Lagendijk, chairman of the Turkey-EU delegation in the European Parliament. Lagendijk urged the ruling party to show more "sensitivity" to concerns of its Turkish critics as well as "clear signs" that it is committed to the secular ideals of the state. State Department spokesman Sean McCormack reacted to the court's decision by saying the US would continue to work with the government and encouraging it to "reinvigorate its efforts with the EU." The court case was the latest battleground between the pious Muslims who run the government, but embrace aspects of Western political and economic systems, and the secular establishment that draws support from the military and judiciary. The rift has evolved over the last century since national founder Mustafa Kemal Ataturk jettisoned Islam as a guiding force in society and politics, instead imposing a strictly secular system amid the ruins of the Ottoman Empire. In announcing the court decision, Kilic appealed for politicians to seek consensus and said the case exposed the need for legal reforms that will elevate Turkish democracy, which has endured weak coalitions and several military coups over the decades. Mustafa Ozyurek, deputy chairman of the main opposition party, noted a majority of the judges had effectively agreed the ruling party was a focal point for anti-secular activities. If the ruling party "draws a lesson from this decision, then there will be no problem," said Ozyurek, a member of the Republican People's Party. "But if it does not, then Turkey will be dragged into chaos once again." Gen. Yasar Buyukanit, the military chief, did not comment directly on the verdict, but stressed the role of the military as a guardian of secularism. In March, Turkey's chief prosecutor asked the Constitutional Court to disband Erdogan's party and bar him and 70 other party members from joining any other political party for five years. President Abdullah Gul was also on the prosecutor's list. Prominent leaders in the government have backgrounds in political Islam, and the party itself is a successor to parties that were banned in the past. Those leaders now say they are not following an Islamic agenda, citing the EU-backed reforms as proof. The judges began hearing the case Monday, a day after two bombs exploded on a packed Istanbul square. It was the deadliest attack in Turkey in almost five years. Turkish officials blamed Kurdish separatists, who denied responsibility. The timing of the attack raised speculation over a possible link to the political fight. Prosecutors are preparing a case against alleged coup plotters, including retired army officers, who are accused of trying to bring down the Islamic-oriented government by fomenting chaos in Turkey. This year, the ruling party attempted to lift a decades-old ban on the wearing of head scarves at universities, but the top court overturned that bill, saying it was anti-secularist. Chief prosecutor Abdurrahman Yalcinkaya cited the head scarf bill as proof the government was trying to scrap secularist principles in the constitution.