WASHINGTON, Oct. 12— In a sweeping indictment of the four-year effort in Iraq, the former top American commander called the Bush administration’s handling of the war incompetent and warned that the United States was “living a nightmare with no end in sight.”

In one of his first major public speeches since leaving the Army in late 2006, retired Lt. Gen. Ricardo S. Sanchez blamed the administration for a “catastrophically flawed, unrealistically optimistic war plan” and denounced the current “surge” strategy as a “desperate” move that will not achieve long-term stability.

“After more than fours years of fighting, America continues its desperate struggle in Iraq without any concerted effort to devise a strategy that will achieve victory in that war-torn country or in the greater conflict against extremism,” Mr. Sanchez said, at a gathering here of military reporters and editors.

General Sanchez is the most senior in a string of retired generals to harshly criticize the administration’s conduct of the war. Asked following his remarks why he waited nearly a year after his retirement to outline his views, he responded that that it was not the place of active duty officers to challenge lawful orders from civilian authorities. General Sanchez, who is said to be considering a book, promised further public statements criticizing officials by name.