COTONOU, Benin — After 52 days under virtual house arrest, the former president of the West African nation of Benin was set free and fled across the border to Togo last week without a word to his supporters or the media.

Who had held him? The country’s current president, Patrice Talon, a businessman whose grip on the country — formerly one of Africa’s most stable democracies — has grown increasingly autocratic since his election in 2016.

Benin had long prided itself on two things: its bountiful cotton crop and a robust democracy that allowed freedom of speech, fair elections and peaceful transitions of power for nearly the last three decades.

But recent crackdowns on free speech, repression of political opponents, and the detention of the former president, Thomas Boni Yayi — all once unthinkable here — have sent the country reeling. Mr. Yayi was detained after he spoke out against new electoral rules imposed by his successor, Mr. Talon, that essentially made it impossible for anyone other than Mr. Talon’s supporters to run for office.