The coda to one of New York’s most gripping and erratic criminal dramas lasted all of 12 minutes.

A prosecutor spoke first, quickly summarizing what had been obvious for weeks: the Manhattan district attorney’s office had little confidence in its case, and even less trust in the accuser it had initially championed. A defense lawyer was next, saying simply, “We do not oppose the motion.”

Then the judge spoke.

And just like that, the sexual-assault case against Dominique Strauss-Kahn was dismissed Tuesday, bringing an abrupt end to what had been a three-month episodic criminal investigation, each chapter offering a sensational twist on the underlying storyline: Mr. Strauss-Kahn, a man of international power and prestige, was accused of sexually assaulting an immigrant hotel housekeeper after she entered his suite to clean it.

The dismissal order issued by Justice Michael J. Obus of State Supreme Court in Manhattan brought some semblance of legal vindication to Mr. Strauss-Kahn, 62, after his stunning and embarrassing arrest more than three months ago. He was taken into custody on May 14 aboard an Air France jet at Kennedy International Airport, and then appeared disheveled and in handcuffs before news cameras.

After the hearing Tuesday, Mr. Strauss-Kahn issued his first statement since his arrest, characterizing the criminal inquiry as “a nightmare for me and my family” and thanking the judge, his own wife, Anne Sinclair, and family and other supporters.