Former Malaysian prime minister Najib Razak has been charged with corruption, in a dramatic fall from grace two months after he lost office.

He pleaded not guilty to three counts of criminal breach of trust and one of abuse of power, and was freed on bail.

Mr Najib is accused of taking $700m (£517m) from a state fund he set up.

Police have recovered $273m in luxury goods and cash from raids on properties linked to Mr Najib. He and his wife say the items were legally acquired.

A new investigation into the state development fund 1MDB began after his shock election loss in May.

Mr Najib was arrested by anti-corruption authorities on Tuesday and spent the night in detention.

In a video posted on Twitter a day earlier, he appealed to the public not to believe the reports, saying that not all of the accusations were true. “I have not had a chance to defend myself,” he said.

The charges against him each carry a maximum of 20 years imprisonment.

The bail amount was set at 1m Malaysian ringgit ($250,000; £190,000).

Najib Razak: Malaysia’s tainted political aristocrat
1MDB: Malaysia’s global corruption scandal
Corruption, money and Malaysia’s election

Several hundred people gathered outside Kuala Lumpur High Court to see Mr Najib. Some of his supporters turned up, as did dozens of journalists.

There were also onlookers; people who had come simply to see a former prime minister appear in court.

Mr Najib showed little emotion as he pushed his way through the crowd to the court’s main door.

It’s not clear if it was his decision to walk in using the front entrance, or whether he had been forced to.

Inside, other cases were taking place, but the main interest was on Mr Najib.

Ushers constantly tried to silence excited people gathered in corridors; the noise was disturbing other cases.

Lawyers waiting to be called for their own hearings wandered over to try to get a look at the former prime minister. “I never thought I’d see the day,” said one.

1MDB, set up by Mr Najib in 2009, was meant to turn the capital, Kuala Lumpur, into a financial hub and boost the economy through strategic investments.

But it started to attract negative attention in early 2015 after it missed payments for some of the $11bn it owed to banks and bondholders.

Then the Wall Street Journal (WSJ) reported it had seen a paper trail that allegedly traced close to $700m from the fund to Mr Najib’s personal bank accounts.

Billions of dollars are still unaccounted for.

Mr Najib has always denied the corruption charges and had been cleared by Malaysian authorities while in power, but he is being investigated by several other countries.

The allegations played a central role in his defeat to former ally, 93-year-old Mahathir Mohamad, in May.

Mr Mahathir pledged to re-open the investigation and Mr Najib was banned from leaving Malaysia.

Raids in recent weeks have been carried out across properties linked to Mr Najib and his wife. Police say the seizure of valuables was the biggest in Malaysian history.

Jewellery accounted for the biggest portion of the seizure, with the most expensive item being a $1.6m diamond and gold necklace.