The Gupta empire was getting squeezed. Locked out of banks, the brothers could not pay their employees or debts. Their only public company was delisted from the Johannesburg stock exchange. South African companies, big and small, refused to do business with them.

Cornered, they sold a mining company and their media empire in quick succession. Many of their remaining companies filed for bankruptcy protection and are now managed by outside supervisors.

Everything might have worked out for them had Mr. Zuma’s ex-wife won. But one of her supporters, David Mabuza — who had become a kingmaker by diverting government money to finance his political rise — flipped his votes at the last minute, handing Mr. Ramaphosa a slim victory.

Mr. Zuma technically had more than a year left as South Africa’s president. But it became clear he would be forced out much sooner.

South Africans, predicting the end of the Guptas, began tracking the family’s prized Bombardier Global 6000 jet as it traveled to Dubai, Russia, Switzerland and elsewhere.

On Feb. 4, the Guptas turned off the jet’s GPS tracking device, according to Canada’s export credit agency, which had lent the Guptas $41 million to buy the Bombardier. The agency sued to get the plane back, saying the Guptas might use it “to escape justice.”

Ten days later — on the day Mr. Zuma finally gave up and resigned as South Africa’s president — law enforcement officials raided the Gupta estate in Johannesburg. The message was clear: It was over for the Guptas.