A prize-winning New York-based Cameroonian novelist will be freed from jail and expelled from his native country after being held for nearly three weeks on charges of insulting and threatening the president, his lawyer said on Wednesday.

Patrice Nganang was arrested on Dec. 7 as he prepared to board a flight to Kenya, and accused of insulting President Paul Biya. The government later said he had threatened Biya in posts on Facebook.

A literature professor at the State University of New York at Stony Brook, Nganang was born in Cameroon and holds dual Cameroonian and U.S. nationality.

Nganang’s lawyer, Emmanuel Simh, told Reuters that a judge had dismissed the government’s charges and ordered his client released. Simh later said the authorities had retained Nganang’s Cameroonian passport and that he would be placed on an afternoon flight to the United States.