Image copyright AFP

On 16 January 2017 a cargo plane flying from Hong Kong to Istanbul crash-landed just outside the main airport for Bishkek, Kyrgyzstan.

As well as all four crew members, at least 33 people on the ground were killed. Locals said entire families had been wiped out in the disaster.

Media playback is unsupported on your device Media caption Footage showed the wreckage strewn across a large area

The images are horrific, but it's reassuring to know accidental plane crashes in residential areas are incredibly rare, a fact largely attributable to pilot training.

"The rules of flying in an emergency are first you aviate, then you navigate, then you communicate," says Greg Waldron, Asia managing editor at Flight Global.

Image copyright AP Image caption A skilled pilot with the right information can avert a major disaster

In other words, the pilot's priority is keeping the plane in the air, then working out the route, then telling everyone what's going on, though all of this can happen very quickly.

"Pilots will always avoid coming down in a civilian area if they can, but situations during these instances can be very intense and hectic," says Mr Waldron.

"A lot will depend on how much control they have over the aircraft."

This was the case, for example, with Chesley Sullenberger, aka Sully, who was flying an Airbus 320 over New York in January 2009 when its engines were disabled by a bird strike.

He made the quick calculation that he could not risk diverting to a nearby airport, as the plane could come down on populated areas, and so landed in the middle of the Hudson River.

After an investigation, he was judged to have made the right decision, which saved the lives of 155 people on board and possibly numerous more on the ground.

Image copyright Getty Images Image caption The TransAsia plane came down just short of highrise buildings

A similar incident in Taiwan in February 2015 saw a TransAsia flight crashing in a river in the middle of Taipei. Dramatic images showed the plane narrowly missing cars on a busy bridge as it came down. Forty-three people died.

It was later discovered that one engine had malfunctioned and the crew accidentally shut down the working engine instead. It remains unclear whether the river landing was pilot skill or chance, says Mr Waldron.

These incidents happened in daytime and in good flying conditions, but the situation can be very different if flying at night, as the Turkish airline crew were this week, he says.

The two-man crew of a Bombardier freighter which crashed in Norway in 2016, experienced "spatial disorientation" after getting confusing technical readings about their height and speed while flying at night, the official investigation found.

They did the right thing but, "guided by the erroneous information", flew straight into a mountain, killing them both.

'Flying is safe'

The Kyrgyzstan government has been quick to blame the Bishkek crash on pilot error, but with debris still strewn across the ground, it's far too soon to make that assessment, says Mr Waldron.

Studying the plane's flight deck recorder black box data will be crucial to finding out what the crew was going through and how it could be avoided in the future.

But Mr Waldron is keen to stress that despite the horror of such catastrophes, flying remains an extremely safe mode of transport.

Some recent crash disasters in residential areas

Medan, Indonesia

Image copyright Getty Images

On 30 June 2015, an Indonesian Hercules military plane crashed in a densely populated area shortly after taking off from Medan airport in northern Sumatra.

Most of those killed were on board, but at least 17 people died on the ground.

Medan had had a similar disaster 10 years before, when a Boeing 737 crashed after taking-off from Polonia airport. Nearly 50 local residents died. A hundred passengers and crew died, though there were some survivors.

Brazzaville, Congo

In November 2012 an Ilyushin-76 cargo plane hit trees on landing at Maya-Maya airport in Brazzaville, the capital of the Republic of Congo.

The plane careered off the runway into nearby buildings before plunging into a ravine. Most of the 32 people who died were on the ground.

In March 2011, 14 people died on the ground, along with nine on board, when a cargo plane fell on a residential area in Pointe-Noire, also in Congo.

Lagos, Nigeria

Image copyright AFP

A Dana Air plane carrying 153 people crashed into buildings in Nigeria's largest city in June 2012 after an engine failure.

Everyone on board died, while the final death toll among non-passengers was 10.

Mexico

On 4 November 2008, a light aircraft carrying Mexican Interior Minister Juan Camilo Mourino among its nine passengers crashed in the financial district of Mexico City. Seven people died on the ground.

New York, US

Image copyright Getty Images

American Airlines Flight 587 broke up mid-air after taking off from New York JFK airport in November 2001. It came down on houses on the borough of Queens, causing a fire which burned several homes.

As well as 251 passengers and crew, five people died on the ground in the second-worst aviation disaster in US history. Despite fears it had been a terror attack, the investigation blamed pilot error.

Reporting by Anna Jones

This list is not comprehensive and does not include incidents of terrorism