BANGKOK - A nighttime fire at a dormitory of a primary school in northern Thailand killed 18 girls, many of whom had been roused by a dorm-mate but went back to sleep, thinking it was a prank, officials and the girl who sounded the alarm said Monday. The victims were between 5 and 12 years old.

Five girls were injured in the Sunday night fire. Many survived by rappelling down from a second-floor window using sheets tied together to form a rope.

In this image made from video, the outside of a damaged school dormatory is seen where local police say 18 girls, ranging from 5 to 12 years old, died in a fire in Chiang Rai province, northern Thailand, May 23, 2016. Police officials say five other girls were injured, with two in serious condition, in the fire, late Sunday. ( Voice TV Thailand via AP

The two-story wooden structure that caught fire housed 38 girls, most of them belonging to the area's ethnic minorities. Fifteen girls escaped without injuries. The cause of the fire was not immediately known.

Get Breaking News Delivered to Your Inbox

Some of the students were still not asleep when the fire broke out and were able to raise the alarm, said Rewat Wassana, manager of the Pithakkaiat Witthaya School, to which the dorm is attached.

The kindergarten and primary school in Wiang Pa Pao district, just outside the city of Chiang Rai, has about 400 day students and boarders. Reuters reports it's a Christian school. It is about 500 miles north of Bangkok.

Family members mourn the death of two of their daughters as they weep outside of the school dormitory where a fire broke out on Sunday night killing at least numerous young girls in Wiang Papao, Chiang Rai province, Thailand, May 23, 2016.

Rewat said the fire broke out in the dorm's lower level, which is used for activities. Preliminary indications suggested a faulty fluorescent light on the ground floor may have been the cause, Sant Sukhavachana, a senior regional forensics officer, told Reuters. The upper level housed the sleeping quarters. It is one of the two dorms on the 20-acre school grounds. The other dorm, which is located nearby and is for boys, was untouched, Rewat said.

"We have a teacher who sleeps with the girls in the dorm. She tried to help the students escape," Rewat told reporters at a news conference broadcast on local television.

An 11-year-old girl identified only as Suchada said at the same news conference that she had gotten up to go to the bathroom when she noticed the fire downstairs, and ran to tell her friends in various rooms. But some of them didn't believe her and closed the door on her to go back to sleep, she said.

"We remembered some lessons from Girl Scouts to tie cloth together to make a long rope and we climbed out of the window," the fifth-grade student said. "The teacher helped us. While the teacher was climbing down, the rope tore and she hurt her leg and waist."

A police official told The Associated Press by phone that besides the 18 dead, another five girls were injured, including two in serious condition. He said two of the bodies were so badly burned they were unidentifiable. The official did not wish to be identified because he was not authorized to speak to the media.

Firefighters took three hours to extinguish the fire, and pulled survivors and bodies from the second-story window of the wooden building.