A court in the Japanese capital granted bail Tuesday to former Nissan boss Carlos Ghosn on his third request, after nearly four months in jail for alleged financial crimes.

The Tokyo District Court set the bail at 1 billion yen ($8.9 million), saying Ghosn had to submit to restrictions on his residence in Japan, could not travel abroad and had to adhere to other unspecified conditions to prevent him from tampering with evidence. The prosecutor’s office filed an appeal against his release, but it was turned down.

Ghosn said he was extremely grateful for his family and friends “who have stood by me throughout this terrible ordeal.”

“I am also grateful to the NGOs and human rights activists in Japan and around the world who fight for the cause of presumption of innocence and a fair trial,” he said in a statement. “I am innocent and totally committed to vigorously defending myself in a fair trial against these meritless and unsubstantiated accusations.”

Ghosn, one of the auto industry’s most celebrated executives, was arrested Nov. 19 and charged with falsifying financial information and aggravated breach of trust, charges that carry a maximum prison sentence of 10 years.

His case has put a spotlight on Japan’s legal system, in which prosecutors wield huge powers, defendants are routinely detained for months without the right to an attorney during questioning, and conviction rates, once a case goes to trial, exceed 95 percent.

Ghosn earned a reputation as one of the auto industry’s top executives after turning around the fortunes of Renault and Nissan and bringing the two companies together in a three-way alliance with Mitsubishi.

But his efforts to forge even closer links between Renault and Nissan ran into opposition from within the Japanese company, and many experts say that may have been a factor in his downfall.

Two previous applications for bail were denied, but the appointment of a new lead defense attorney, Junichiro Hironaka, nicknamed “the Razor” for his combative style and ability to win acquittals, has brought an upturn in his fortunes.

Speaking at the Foreign Correspondents’ Club of Japan on Monday, Hironaka said he had proposed strict conditions on bail to win Ghosn’s release.

“It would mean less freedom for Mr. Ghosn, but we proposed limiting exchange of information with the outside by using computers and monitoring cameras,” he said.

Hironaka questioned why the case had been brought against Ghosn now, arguing that the allegations date back a decade and would have been known about by Nissan executives. In any case, they should have been dealt with as an internal company matter, he argued.

Ghosn attorneys based in France revealed Monday that they have complained to the United Nations that his rights have been violated during detention in Japan, Reuters reported.

Hironaka referred to his client’s long detention as an example of Japan’s system of “hostage justice,” and he accused prosecutors of “lacking in balance” by bringing charges against Ghosn while declining to bring charges against Toshiba executives after a larger accounting scandal in 2015.

Hironaka said he was determined to restore Japan’s reputation, which he said has been tarnished by Ghosn’s arrest.

“I am going test if my ‘razor’ still remains as sharp at the age of 73,” Hironaka said.