South Africa’s top court has sentenced former president Jacob Zuma to 15 months in prison for contempt of court after he defied an order to attend an inquiry into allegations of corruption under his presidency.

“The only appropriate sanction is a direct, unsuspended order of imprisonment” lasting 15 months, the constitutional court said in a judgment on Tuesday. This is the first time in the country’s history that a former president has been sentenced to jail.

Zuma, 79, must turn himself in to police within five days. If he fails to do so, the police must “take all steps necessary” to ensure that he goes to jail, the court said. Zuma is normally based at his homestead in Nkandla, in rural KwaZulu-Natal.

The court’s ruling has been welcomed by civil society activists as a key moment for South African democracy. The ruling African National Congress called on its “members to remain calm”. Zuma led the party for nearly a decade and still has supporters within the ANC.

The case has been seen as a major test for the judiciary and the inquiry. Zuma “sought to ignore, undermine and in many ways destroy the rule of law altogether”, the court said.

It found Zuma was in contempt of court and said it was responding to “a series of direct assaults and calculated and insidious efforts by [Zuma] to corrode its legitimacy and authority”. It added: “The strength of the judiciary is being tested . . . never before has the judicial process been so threatened.”

The former president had ignored an order to appear before the commission of inquiry into corruption and Raymond Zondo, South Africa’s deputy chief justice and the head of the inquiry, had sought to have him jailed for his defiance.

The long-running inquiry has been investigating claims that Zuma helped the Guptas, a well-known business family, secure state contracts and determine policy, in what became known as the “state capture” scandal. The Guptas and Zuma deny wrongdoing.

Zuma was forced to step down in 2018 over corruption scandals and the inquiry has become one of the most powerful symbols of the clean-up under Zuma’s successor Cyril Ramaphosa — as well as of its limitations and torpor.

Dozens of witnesses have implicated the former president in systematic corruption, including the manipulation of ministerial appointments and contracts to favour the business empire of the Indian-born family.

Zuma made one brief appearance before the inquiry in 2019 to deny involvement in corruption and to claim that his accusers were part of a western-sponsored “drive to remove me from the scene”.

But at his next appearance, he refused to answer questions and staged a walkout and has not returned to the witness stand.

The former president also refused to engage with the constitutional court. “It is not our law that I defy, but a few lawless judges who have left their constitutional post for political expediency,” Zuma said, referring to Zondo and the justices at the constitutional court.

Zuma’s defiance left the court with no choice, said Lawson Naidoo, executive secretary of the Council for the Advancement of the South African Constitution, a legal watchdog, describing it as a “great day for constitutionalism and the rule of law in South Africa . . . It is a real affirmation of the fundamental principles of our democratic state.”

Zuma, who was a prisoner in the notorious apartheid-era jail at Robben Island and ANC intelligence boss during the anti-apartheid struggle, has said he would rather face jail than follow an order to return to the inquiry.

Even so, Zuma and his legal team “believed he would get a suspended sentence” rather than direct imprisonment, said William Gumede, chair of the Democracy Works foundation. “He is going to try and turn it into a martyrdom” but “this is a shock to him”, he said.

The judgment will send a strong signal that even senior leaders in the ANC are not untouchable, said Gumede. “People are shaking in their boots now . . . if the former president with his still-considerable power in the country can be jailed . . . if you’re a lower official, your day is going to come,” Gumede said.

“It’s an absolutely important ruling to draw a line in the sand for the rule of law in South Africa,” he said, hailing the constitutional court as “the last frontier, the last line of defence” for South Africa’s democracy.

“This is a historically significant moment,” said Karam Singh, head of legal and investigations at Corruption Watch, an anti-graft non-governmental organisation. “For the first time in South Africa, we are seeing a former head of state held directly accountable by way of a prison sentence.”