The highest court in South Africa has ruled that President Jacob Zuma violated the constitution when he failed to repay government money spent on his private home.
It gave the treasury 60 days to determine how much he should repay.
The ruling is a victory for the opposition, who said they would push for Mr Zuma’s impeachment.
They accuse him of using ill-gotten wealth to upgrade his home with a swimming pool and amphitheatre.
Mr Zuma has denied any wrongdoing.
A government statement said he would reflect on the judgement and take appropriate action.
An anti-corruption body, known as the public protector, ruled in 2014 that $23m (£15m) had been spent on his rural home in Nkandla in South Africa’s KwaZulu-Natal province.
The public protector said Mr Zuma had unduly benefited from the renovations and should repay a portion of the money.
In a unanimous judgement on behalf of the Constitutional Court’s, 11 judges, Chief Justice Mogoeng Mogoeng said the public protector was a Biblical David fighting against the Goliath of corruption.
“Mr Zuma’s failure to repay the money was inconsistent with the constitution. The president failed to uphold, defend and respect the constitution,” he said.
The case was brought by two opposition parties, the Economic Freedom Fighters (EFF) and the Democratic Alliance (DA).
The EFF called on Mr Zuma to step down while the DA said it would table a motion in parliament to demand his impeachment.
Mr Zuma’s term in government has been marred by allegations of corruption and cronyism.
He was first elected in 2009 and is due to step down in 2019.
The governing African National Congress said it respected the ruling.
It has so far rejected growing pressure to force Mr Zuma out of office.