HARARE, Zimbabwe—Zimbabwean President Robert Mugabe was confined to his home Wednesday as the military tightened its grip over government and civic institutions, following an overnight operation that could spell the ouster of the world’s oldest head of state.

Soldiers rolled into the capital on tanks and armored personnel carriers Tuesday evening, meeting little resistance as they secured the city’s airport, government buildings, state broadcasters and the president’s residence.

Military officers detained top allies of the 93-year-old Mr. Mugabe, including the country’s finance minister. Armored vehicles blocked strategic intersections in the central and business districts, while the state broadcaster played news bulletins and a loop of patriotic songs.

The military takeover of the capital marked a dramatic shift in fortunes for Mr. Mugabe, the school teacher-turned-revolutionary who has ruled this resource-rich southern African nation for 37 years. He has depended on his security forces to maintain his grip on Zimbabwe through a series of punishing economic crises and despite appearing increasingly frail in recent years.

Mr. Mugabe told South African President Jacob Zuma in a call that he was confined to his home and was fine, according to South Africa’s presidency. Mr. Zuma’s office announced that he had dispatched envoys from the Southern African Development Community to Zimbabwe to mediate between the government and the military.