WASHINGTON — American commandos operating under the cover of night seized the man suspected of leading the deadly attack on the United States Mission in Benghazi, Libya, the government announced on Tuesday, ending a manhunt that had dragged on for nearly two years and inflamed domestic and international politics.

With drones hovering overhead, about two dozen Delta Force commandos and two or three F.B.I. agents descended on the outskirts of Benghazi just after midnight local time on Monday; grabbed the suspect, Ahmed Abu Khattala; stuffed him into a vehicle and raced away, according to officials briefed on the operation. No shots were fired, and the suspect was spirited out of Libya to a United States Navy warship in the Mediterranean.

The capture was a breakthrough in finding the perpetrators of an episode that has been politically divisive from the start. President Obama and the State Department have been buffeted by multiple investigations and charges of misleading the public about the circumstances of the attack, which cost the lives of Ambassador J. Christopher Stevens and three other Americans on Sept. 11, 2012. The president and administration officials have strongly rebutted the allegations and accused Republicans of politicizing a national tragedy.

Through it all, Mr. Abu Khattala has remained free, at times almost taunting the United States to catch him, eliciting more criticism of Mr. Obama for not doing enough to bring him to justice. In recent months, Mr. Abu Khattala had gone underground. But officials said new intelligence obtained last week indicated that he was going to be in a place that was “advantageous,” as one put it, because there would be few people around and less risk to American commandos. Mr. Obama gave the order on Friday to capture him.