From Baghdad to Gaza, democratic elections are changing the Middle East. One by one, dictatorships and regimes rife with corruption are being thrown out of power. However, those coming to power with the shake-up of the status quo are far from what the United States and other democratic nations of the West expected.

It would be a major mistake to view Hamas' victory in the parliamentary elections only in the Palestinian context -- a mistake that could threaten America's national security and the strategic investment it made by toppling Saddam Hussein. Hamas' victory illustrates the trend in the Middle East of radical Islamists gaining legitimacy through democratic means.

What's more, the visit of Khaled Mashaal, Hamas' exiled political leader, to the Turkish capital of Ankara was even more surprising. Turkish Foreign Minister Abdullah Gul says the Turkish government was merely accepting a visit by democratically elected officials. Yet the United States and many others consider Hamas a terrorist organization. Ankara used to do so, too. The group hasn't accepted either the president's or the Israelis' call to put down their arms, recognize Israel and continue peace negotiations. Ankara accepted Hamas before it committed to any of the above -- the first post-election sign of legitimacy.

Mr. Gul says the fact that there was a visit is not important, and that the message Turkey gave Hamas is to put down arms, accept Israel's existence and continue the peace process. But he should know better. Muslim societies sometimes pay more attention to symbols than substance. Turkish media is flooded with reports about whether or not the Foreign Ministry knew of Hamas' visit; the speculation is that Ahmet Davutoglu, the prime minister's chief foreign affairs adviser, came up with the idea, and didn't tell the Foreign Ministry about it until the very last minute.

If Ankara thought it was getting a strategic gain with this visit, the way it told the public made it hard to believe it was coordinated with Western governments. Turkey seems to be shooting itself in the foot. There is no justification for allowing this visit; it doesn't protect the country's interests or help to make it a regional power. If Ankara wants to be a player in the Middle East, it needs Washington on its side. Ambassador Ziad Asali, the head of the American Task Force for Palestine, says Palestinians should know the truth: America has no intention of talking to Hamas, directly or indirectly. Ankara has stepped into a big game -- and it appears to have done so with little preparation.

It's essential to understand why Hamas and the Justice and Development Party succeeded. The 2001 economic crisis had tested Turkish people's patience; they were fed up with corrupt officials who weren't interested in the country's needs. Unfortunately, pro-American and pro-Israel officials were the worst offenders, creating a terrible perception that the West was against anything decent for the people. Poverty bred resentment, and people turned to religion. They thought those who claim to be more faithful than the so-called "Western" Muslims should have been honest about ending corruption. But even in that atmosphere, the Justice and Development Party won less than 35 percent of the national vote.

It is the same with the Palestinians. People are tired of living without hope for their future. Those who ruled for years and worked with the West were the most corrupt. The Palestinians didn't elect Hamas to change the future of their society in terms of Islam. But they had no alternative if they wanted to democratically teach their elected officials a lesson.

The pattern was repeated in Egypt. Last December, the Muslim Brotherhood scored massive electoral gains, making it the main opposition to President Hosni Mubarak's ruling National Democratic Party. In Morocco, an Islamic Party, the Parti de la Justice et du Development, took third place in its legislative elections.

So the question is: What point are Turkey's elected officials trying to make? From the day Prime Minister Recep Tayyip Erdogan was elected, his intentions have been unclear. Hamas' visit to Ankara may be the first real clue about whether Mr. Erdogan wants to take Turkey to the European Union or the Muslim Middle East. At a time when people's faith has been tested in the West through the Muhammad caricatures, the feeling that Turkey's service as a NATO member has never been really appreciated, or that it's still difficult for Turkey to be accepted as part of Europe, Mr. Erdogan can focus on being part of the Muslim Middle East.

That would seal the failure of the first revolution in which a Muslim nation became secular. That is what is at stake. And it's why the West should not lose any ground for the people who want to stay as secular democracies.

Tulin Daloglu is the Washington correspondent and columnist for Turkey's Star TV and newspaper. A former BBC reporter, she writes occasionally for The Washington Times.

We have implemented a new commenting system. To use it you must login/register with disqus. Registering is simple and can be done while posting this comment itself. Please contact gzenone [at] horowitzfreedomcenter.org if you have any difficulties.