FILE PHOTO: Australian filmmaker James Ricketson shouts inside a prison truck as he leaves the Municipal Court of Phnom Penh, Cambodia, August 31, 2018. REUTERS/Samrang Pring

PHNOM PENH (Reuters) - Cambodia has granted a pardon to an Australian filmmaker jailed in August on espionage charges for six years, a court in Phnom Penh said on Friday.

James Ricketson was freed from prison later in the day and Cambodia’s immigration department said he would be deported back to Australia.

The 69-year-old was arrested in June 2017 after he was photographed flying a drone above a rally organized by the now-dissolved opposition Cambodia National Rescue Party (CNRP) before communal elections.

The filmmaker, who has been visiting Cambodia for more than 20 years, producing documentaries about the country and its people, was charged with espionage. Ricketson was released from prison at 5 p.m., said Be Tea Leng, the deputy director of Phnom Penh’s Prey Sar prison where Ricketson had been jailed.

“We are happy. We are grateful for the royal pardon. It’s the best news ever,” Jamie Ricketson, one of Ricketson’s sons, told reporters.

Uk Heisela, investigation chief at Cambodia’s immigration department, said Ricketson would be deported back to Australia.

“We will deport him tonight because he committed a crime in this country,” Uk Heisela told Reuters.

Reuters was not able to immediately reach Ricketson for comment. The Australian Embassy in Cambodia did not immediately reply to a Reuters request for comment by email.