KHARTOUM (Reuters) - A Sudanese judge on Saturday formally indicted Omar al-Bashir for possessing illicit foreign currency and corruption, charges the ousted leader challenged as he was publicly questioned for the first time since his overthrow.

Bashir said that he had received $25 million from Saudi Crown Prince Mohammed bin Salman, as well as funds from other sources, but that he had not received or used the money for his own benefit.

A lawyer for Bashir said that his client denied the charges against him and that witnesses for the defence would be presented at the next hearing.

The judge denied a request for bail and said a decision on the duration of Bashir’s detention would be taken at a hearing on Sept. 7. Foreign currency held by Bashir was illicit and had been transferred illegally, he said.

Millions of euros and Sudanese pounds were found at Bashir’s residence in April when he was toppled and arrested, a judicial source said at the time.

Sudan’s military ousted Bashir after months of protests across the country. His prosecution is seen as a test of how far military and civilian authorities now sharing power will go to counter the legacy of his 30-year rule.

Bashir, who appeared in traditional white robes in a metal courtroom cage and spoke slowly into a microphone, said his former office manager had received a message from Mohammed bin Salman’s office that a sum of money in euros worth $25 million would be sent by private plane for extra-budgetary needs.

Slideshow ( 6 images )

“It was not possible to present the money to the ministry of finance or the central bank because that would have required clarifying the source of the funds, and the Saudi prince asked that his name should not appear,” said Bashir.

“I used the money for private donations to various parties,” including medical services, a university, an Islamic media channel, and the urgent provision of petroleum products, he said.

Bashir gave no date for the transfer. Saudi authorities did not immediately respond to a request for comment.

Bashir said he had also received more than five million Sudanese pounds ($111,110) from the head of a cereals company that provides much of Sudan’s flour, to be exchanged for foreign currency for flour imports.

The charges against Bashir carry maximum prison sentences of around 10 years.

Bashir was charged in May with incitement and involvement in the killing of protesters. The International Criminal Court in The Hague issued arrest warrants against him in 2009 and 2010 on charges of war crimes, crimes against humanity, and genocide in Sudan’s Darfur region.

A police detective told the court earlier this month that Bashir had acknowledged receiving millions from Saudi Arabia.