Later, as a dramatic day came to a close, Mr. Erdogan emerged from a meeting with President Abdullah Gul in Ankara, the Turkish capital, and announced that seven other ministers would leave his cabinet, some of whom are departing as part of a long-planned shuffle so that they can run for mayors in coming elections. One of the late-night departures included the European Union minister, who has been implicated in the corruption investigation.

The investigation became public a week ago with dawn police raids on the offices of businessmen and others close to the prime minister. But Wednesday was the first time that someone who had been in Mr. Erdogan’s hierarchy — a confidant, no less — left the strong implication of the prime minister’s entanglements in some of the real estate deals at the heart of the case.

The crisis strikes a sharp contrast to the image that Turkey has projected as an exemplar of a prosperous, Muslim-majority country based on democratic principles. A NATO member, Turkey has been embraced by the United States and Europe as a force for stability in the tumultuous Middle East, and the country has sought to play an important role in shaping the outcome of crises in Syria, Egypt and with Iran’s nuclear program. With Mr. Erdogan now preoccupied with political survival, Turkey’s role in the region and its relationship with the West are in question.

The corruption inquiry has targeted the ministers’ sons, a major construction tycoon with links to Mr. Erdogan and municipal workers, and it centers in part on allegations that officials received bribes in exchange for ignoring zoning rules and approving contentious development projects. No one has been convicted, but the issue has struck a nerve among the Turkish public, especially Istanbul residents. They have become increasingly resentful over the dizzying pace of development and riches amassed by a new, pious economic elite, with a strong hand in the construction industry, which rose to power alongside Mr. Erdogan and his associates.

Analysts questioned whether Mr. Erdogan can weather the crisis by blaming foreign powers, appealing to the religious sentiments of supporters, and evoking the ghosts of Turkey’s past by likening it to the war for independence it fought after the breakup of the Ottoman Empire.