A school principal shot by a gunman who laid siege to the institute in southern Thailand has died in hospital, authorities said.

Sasiphat Sinsamosorn and a female student were shot by the 18-year-old man, who entered the school near the city of Hat Yai shortly before 17:00 local time (10:00 GMT) on Wednesday.

Sasiphat died of her injuries before dawn on Thursday, local police said. The student who was shot is in stable condition. Another student who jumped out of a window during the siege is also still in hospital, police said.

The gunman was arrested after a two-hour standoff that saw a number of students and teachers trapped in the Phatong Prathan Keeriwat School building.

The motive for the attack remains unclear, although local media reports suggest the suspect may have had a grievance with a teacher at the school.