When Prime Minister Recep Tayyip Erdogan of Turkey and his Islamic-rooted party came under fierce fire this summer from secularists, who came close to persuading the country's supreme court to bar both from politics, he called the campaign an attack against religious freedom and a threat to Turkey's efforts to join the European Union.