An Indonesian court sentenced two British television journalists to two and a half months in jail on Tuesday for violating immigration regulations by working with tourist visas.

Neil Bonner and Rebecca Prosser were detained in May in Batam, a city just south of Singapore, while making a documentary about piracy in the Malacca Strait.

They were filming a re-enactment of a robbery off Serapat island near Batam and failed to show proper documents, including journalist visas, said Bani Ganting, a prosecutor who sought 5-month jail terms for the defendants.

"I don't think journalism is a crime," Bonner told reporters after the verdict. "I think this makes it a more dangerous landscape for other journalists in Indonesia."

The government has promised to ease visa restrictions for international media since President Joko "Jokowi" Widodo took office last year. However, foreign journalists still need to apply for special visas that can take weeks to be approved or denied.

Bonner and Prosser were working for Wall to Wall, a London-based company that is producing the documentary, funded by National Geographic. They were held under house arrest for four months before being transferred to a prison in Batam in September. Their trial began last month.

A panel of three judges at Batam District Court found them guilty and sentenced them to two and a half months in jail, along with a fine of $1,840 each. The maximum penalty for visa violations is five years' imprisonment.

"What they have done has undermined respect for the law in this country," presiding Judge Wahyu Prasetyo said. "But the defendants were polite, cooperative and admitted their mistakes, and we considered that in lightening their sentences."

Bonner and Prosser decided not to appeal the verdict, but prosecutors are still considering whether to appeal for longer sentences.

The defendants' Indonesian lawyer, Aristo Pangaribuan, said his clients would be released Friday for time already served unless there is an appeal from prosecutors.