Media playback is unsupported on your device Media caption Pakistan military plane crash reduces buildings to rubble

At least 18 people were killed and several injured when a small military plane crashed into a residential area near the Pakistani city of Rawalpindi.

Five crew members and 13 civilians were among the dead, rescue services said.

The aircraft was on a training flight when it crashed and set off a fire across several homes. One witness said the plane was ablaze before the crash.

The King Air 350 turboprop reportedly took a steep turn near its destination airport before coming down.

Image copyright AFP Image caption The city of Rawalpindi is the site of the army's headquarters

Rawalpindi, near the capital Islamabad, is the site of the Pakistani army's headquarters, and the plane belonged to the Pakistani Army's aviation unit.

Pakistan's Prime Minister Imran Khan offered his condolences and wished a "quick recovery for the injured", according to a tweet sent by the Pakistani government.

How did the plane come down?

Witnesses at the scene said the aircraft crashed into a family home in a residential area around 02:00 local time (07:00 GMT).

"I was awake when the plane flew over my room and it was already on fire in the air," said resident Ghulam Khan. "The sound was so scary, it was only a small plane. It then fell on a house where a family used to live."

Another witness, Yasir Baloch, said: "The tail of the plane was on fire and it took barely two to three seconds and it crashed four houses away from my house and burnt to ashes."

A resident near the site of the crash who gave his name as Yamin said he had escaped his burning house with his wife, daughter and parents, but his brother, sister-in-law and nephew died.

"The window and door to their room was locked. We tried our best to get them out but couldn't," he said.

Pictures from the scene showed blackened buildings that had been reduced to rubble. A reporter from the AFP news agency said smoke was still rising from the wreckage and pieces of the plane were visible on a nearby roof.

Image copyright Reuters Image caption Mourners gathered at the site of the plane crash

Several injured were rushed to hospital, Pakistan's emergency rescue services said. The bodies of the dead were taken away to be identified.

"All the bodies are badly burned, so DNA tests are required for identification," said Farooq Butt, a spokesman for the rescue services.

What is Pakistan's safety record like?

Pakistan has a chequered aviation safety record, including a number of airliner crashes.

In 2010, an aircraft operated by private airline Airblue crashed near Islamabad, killing all 152 people on board - the deadliest air disaster in Pakistani history.

In 2012, a Boeing 737-200 operated by Pakistan's Bhoja Air crashed in bad weather on its approach to land in Rawalpindi, killing all 121 passengers and six crew.

And in 2016, a Pakistan International Airlines plane burst into flames while travelling from northern Pakistan to Islamabad, killing 47 people.