Greg Kelly, a United States citizen and a former director of Nissan Motor of Japan, was released from a Tokyo jail on Tuesday.

A Japanese judge, reviewing requests from Mr. Kelly’s family and the United States government, ruled that Mr. Kelly could be freed on bail of 70 million yen, or about $640,000. Prosecutors immediately appealed the decision but the court denied the appeal Tuesday night. Under terms of his bail, he must remain in Japan.

Mr. Kelly, who has been having health problems, was shown walking from the detention center in live coverage Tuesday night from NHK, Japan’s public broadcaster. NHK reported that Mr. Kelly was with a lawyer and both men left in a black taxi. The court said the bail was paid earlier in the day.

Later, television footage showed Mr. Kelly entering a local hospital.

The court decision came more than a month after Mr. Kelly and the carmaker’s chairman, Carlos Ghosn, were arrested on allegations that they had underreported Mr. Ghosn’s compensation to regulators for years. The court set the conditions for the bail, including a requirement that Mr. Kelly not talk to Mr. Ghosn or Nissan executives, and that he not travel abroad.