An Algerian military transport plane crashed Wednesday shortly after taking off from an air base south of the capital, Algiers, killing at least 257 people, according to the Algerian Defense Ministry.

The Russian-built Ilyushin Il-76 was headed to the southwestern city of Bechar carrying Algerian military personnel and passengers, including a group linked to the separatist Polisario Front that is seeking independence from Morocco for the Western Sahara region. Algeria has long backed the Polisario.

The cause of the crash was not immediately clear. Witnesses told Reuters news agency they saw flames coming from a wing before the plane went down in farmland just outside the Boufarik military air base.

The dead included soldiers and family members, officials said, in one of the deadliest aviation incidents in recent years. One Algerian station, TV Dzair, said five people were under medical treatment, but it was not clear whether they had been on the plane or near the crash site.

“The number of martyrs has risen to 247 passengers and 10 members of the crew, most of whom are members of the army as well as their families,” the Defense Ministry said in a statement.

The military added that Gen. Gaid Salah, head of the army, went to the site and ordered an investigation into the crash.

Television images showed black smoke billowing from the crash site, about 20 miles south of Algiers. White body bags were lined up near the wreckage.

The aircraft appeared to be split in half with the back part of the fuselage intact and the tail sticking out of the field. Most of the front of the plane appeared destroyed.

The plane was scheduled to stop in the remote town of Tindouf along the Moroccan border, the site of sprawling refu­gee camps for Western Saharans who have fled their decades-old conflict with Morocco.

The Polisario Front said 30 of its members, including women and children, died in the crash. They had been getting treatment in Algerian hospitals. The group declared a week of mourning.

The Ilyushin Il-76 was first built in the 1970s and is used as a transport plane, often in rugged underdeveloped parts of the world. It has the ability to use unpaved runways.

In February 2014, another Algerian military transport plane, a U.S.-built C-130, crashed into a snowy mountain in eastern Algeria. Seventy-seven people were killed, and one person survived.

Some of the victims of that crash were civilians; military dependents often use the planes to travel along with troops.

In 2003, another Algerian ­C-130 transport crashed when one of its engines caught fire near the Boufarik air base, killing 10 people.

The latest crash is among the deadliest in the past decades. In 2014, a Malaysia Airlines jetliner was shot down over war-ravaged eastern Ukraine, killing all 298 aboard. Earlier in 2014, Malaysia Airlines Flight 370, with 239 passengers and crew, was lost on a flight from Kuala Lumpur to Beijing.

Correction: An earlier version of the map on this page mislocated Algiers, the capital of Algeria.

Brian Murphy in Washington contributed to this report.