At least seven students have been killed and 10 others taken to hospital after a fire broke out at a school in the Kenyan capital, Nairobi, officials said.

The fire, which broke out early on Saturday morning, burnt down one dormitory of Moi Girls school.

"We were sleeping and a girl woke us up and said that our hostel was burning. We were helped to safety by some teachers," Daniella Maina, a shaken 16-year-old schoolgirl, told the Reuters news agency.

The Kenyan police did not immediately respond to a request for comment.

"A fire broke out at the school at 2:00am in the morning in one of the dormitories. It is very, very sad," said Fred Matiangi, education minister.

"This is a school that's got 1,183 students and as you know is one of our top schools in the country and a school that we are very proud of."

Matiangi said it was too early to know what caused the fire and that investigations were under way.

"We have 10 students who have been admitted to hospital right now, two of them with serious injuries. We have taken a decision this morning to close the school for two weeks because we want to conduct thorough investigations on what happened," Matiangi added.

The incident has brought back memories of the deaths of 67 students in a dormitory fire at a high school in eastern Kenya in March 2001.

It later emerged that fire was caused by students apparently angered by the school's administration.

Last year, at least 126 high schools experienced arson attacks in what appeared to be protests by students over the shortening of holidays and limiting of visits by parents.