ALGIERS: More than 250 people were killed when a military plane crashed in a field near Algeria's capital on Wednesday, state media said, with witnesses saying they saw a wing catch fire shortly after the plane took off.

Dozens of firefighters, rescue workers and military officials worked around the blackened fuselage of the aircraft, which had been ripped open near its wings.

Bits of mangled and smouldering debris were scattered across the field near Boufarik airport southwest of Algiers. Earlier TV images showed flames and smoke billowing from the site of the crash.

"This morning at around 8:00 an Ilyushin model military transport plane ... crashed directly after takeoff in an agricultural field that was clear of residents," Major General Boualem Madi told state TV.

A line of white body bags could be seen on the ground next to the wreck of what media said was a Russian Ilyushin Il-76 transport plane, part of which was still intact.

"After taking off, with the plane at a height of 150 meters I saw the fire on its wing. The pilot avoided crashing on the road when he changed the flight path to the field," Abd El Karim, a witness, told the private Ennahar TV station.

Another witness said: "We saw bodies burned. It is a real disaster".

A total of 257 people were killed, most of them military, the defence ministry said. Ten crew and other people described as family members died, and a number of survivors were being treated at an army hospital, the ministry added.

A member of Algeria's ruling FLN party told Ennahar the dead included 26 members of the Polisario Front, an Algerian-backed group fighting for the independence of neighbouring Western Sahara, a territory also claimed by Morocco in a long-running dispute. 

A source close to Polisario said that the dead included four refugee children and that around 30 refugees who had received medical treatment in the capital had been killed in all.

The plane had been heading to Tindouf on the border with Western Sahara, Algeria's defence ministry said. Tindouf is home to tens of thousands of refugees from the Western Sahara standoff.

The defence ministry said in a statement it would investigate the cause of the crash, and it expressed condolences to the families of the victims.

Doctors who have been on strike for months over their pay and work conditions resumed work to treat the survivors, residents said. Some 70 ambulances arrived at the scene after the crash, local media said.

The U.N. has long been trying to broker a settlement for Western Sahara, which has been contested since 1975 when Spanish colonial powers left. Despite Morocco's claims, Polisario established its self-declared Sahrawi Arab Democratic Republic in part of the territory.

Previous major air accidents in Algeria include an Air Algerie flight that crashed in northern Mali in July 2014 carrying 116 passengers and crew, nearly half of them French, en route from Burkina Faso to Algeria.

In February that year, an Algerian Air Force Lockheed C-130 Hercules crashed in a mountainous area in eastern Algeria killing 77 passengers and leaving one survivor.

(Reporting by Lamine Chikhi, Hamid Ould Ahmed, Aidan Lewis, Ahmed Tolba, Ulf Laessing and Tarek Amara Writing by Ulf Laessing and Aidan Lewis Editing by Andrew Heavens and Hugh Lawson) ((Ulf.Laessing@thomsonreuters.com; Reuters Messaging: follow me on twitter @ulflaessing))