An Indonesian teenager was sentenced Tuesday to 18 months in prison for "insulting" President Joko Widodo on Facebook.

The 18-year-old high-school student from Medan on the island of Sumatra, identified by the initials MFB, was found guilty of violating the country's Internet law by making defamatory and slanderous comments online.

Judges also ordered him to pay 10 million rupiah ($700) in fines.

"If the fines are not paid, the jail term is extended by one month," the presiding judge told the Medan court.

The teenager accepted the verdict and did not file an appeal.

MFB was arrested in August last year after he posted numerous inflammatory messages and memes against Widodo and police chief Tito Karnavian using fake accounts.

In July, he made a post challenging the police to arrest him. And they did, a month later.

The government of Indonesia, the world's largest Muslim majority country, has received criticism following a string of arrests of people accused of insulting the president, making slanderous comments and posting fake information on social media.

Democracy and rights activists have branded the internet law draconian and a threat to free speech.

Last week a court in Jambi province, also on Sumatra, sentenced a local politician to one year in jail after he made a Facebook post considered to be insulting Islam. The judges found him guilty of violating the law and "inciting hatred".

In November last year, a man was charged for posting on Instagram images of Widodo's wife, Iriana, with texts considered offensive to the first lady.