BANGKOK — An American journalist who was jailed in Indonesia for allegedly violating the terms of his visa has been deported and was expected to arrive in New York on Saturday.

The journalist, Philip Jacobson, who works for the environmental news organization Mongabay, was detained in mid-December in Palangkaraya, a city in Borneo, and ordered to remain there while his case was investigated. He was later jailed for three days late last month.

Under Indonesia’s harsh immigration law, he could have faced up to five years in prison.

“It’s tragic that an American environmentalist who dedicated his energies to protecting Indonesia’s rain forests and indigenous people has been treated so poorly by the Indonesian authorities,” said Andreas Harsono, an Indonesia researcher at Human Rights Watch. “Authorities should be thanking Jacobson for his environmental work, not punishing him for it.”

Mr. Jacobson was not working as a journalist during his stay in Indonesia, said his lawyer, Aryo Nugroho. He was detained after attending a public meeting and accused of violating the terms of his business visa.