A Thai court has sentenced a university student to 2 1/2 years in prison for posting a message on Facebook that the court found to have insulted the country's king.

A Criminal Court judge on Tuesday found 24-year-old Akkaradet Eiamsuwan guilty of violating Thailand's lese majeste law, which punishes anyone who defames, insults or threatens the monarchy.

The ruling said that Akkaradet used an alias to post the offensive message on Facebook in March.

The court said it reduced the original sentence of five years' imprisonment to 2 1/2 years because the defendant confessed to the offense.

He was arrested in Bangkok in June and has been in jail since.

Thailand's lese majeste law is the world's harshest, calling for a jail term of three to 15 years.