In its decision, the court said Mr. Ghosn would be required to live in Japan and forbidden to travel abroad. Just before midnight, Mr. Ghosn released a statement, emphasizing his relief and his innocence.

“I am extremely grateful for my family and friends who have stood by me throughout this terrible ordeal,” the statement said. “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. I am innocent and totally committed to vigorously defending myself in a fair trial against these meritless and unsubstantiated accusations.”

The length and nature of Mr. Ghosn’s detention have prompted criticism of Japan’s criminal justice system, a point that Mr. Hironaka hammered home Monday.

In mid-December, Mr. Ghosn appeared to be on the verge of being released after the court denied a request by prosecutors to extend his detention. But the authorities then rearrested Mr. Ghosn on a new charge — breach of trust — asserting that he had transferred losses incurred during the 2008 financial crisis to Nissan.

Mr. Ghosn’s close aide Greg Kelly also was arrested in November, in connection with underreporting Mr. Ghosn’s income. Mr. Kelly was granted bail of ¥70 million (about $640,000) on Christmas Day because of ill health. Mr. Kelly, who underwent surgery for a spinal condition, remains restricted to living in Tokyo as part of that bail agreement.

Mr. Ghosn is said to have lost weight in jail. His family, in a statement on Monday, said it had appealed to the United Nations Human Rights Council over the conditions of his detention.

In an interview with Nikkei Asian Review, Mr. Ghosn blamed his arrest on “plot and treason” by executives at Nissan who had misrepresented his attempts to further deepen ties between the Japanese carmaker and Renault. At the helm of the alliance for nearly 20 years, Mr. Ghosn had pushed for more cost savings and more shared engineering and design. There was some tension within Nissan over whether Mr. Ghosn was pushing for a merger.