This article is by Adam Nossiter, Scott Sayare and Dan Bilefsky.

ABIDJAN, Ivory Coast — The strongman of Ivory Coast, Laurent Gbagbo, was captured and taken into custody by his rival on Monday, ending a four-month standoff that left hundreds dead in this once-prosperous West African nation, put international diplomacy to a severe test and ultimately dragged the country back into civil war.

With French helicopters in the skies nearby, Mr. Gbagbo surrendered to his rival’s forces as they stormed his residence, sending his chief of staff outside to signal his defeat.

“The fighting is over,” Mr. Gbagbo said on his rival’s television station after his arrest. “So he went out with a white handkerchief. The fighting is over.”

For months, African diplomats and heads of state had shuttled back and forth to Abidjan, pleading with Mr. Gbagbo to step down after losing a presidential election last year. The United Nations, the United States and the European Union demanded his resignation, imposing severe economic sanctions that crippled the economy — but failed to push Mr. Gbagbo from power.