MAMUJU, INDONESIA -- A strong, shallow earthquake shook Indonesia's Sulawesi island just after midnight Friday, toppling homes and buildings, triggering landslides and killing at least 42 people.

More than 600 people were injured by the magnitude 6.2 quake, which sent people fleeing their homes in the darkness. Authorities were still collecting information about the full scale of casualties and damage in the affected areas.

There were reports of many people trapped in the rubble of collapsed homes and buildings.

In a video released by the National Disaster Mitigation Agency, a girl stuck in the wreckage of a house cried out for help and said she heard the sound of other family members also trapped. “Please help me, it hurts,” the girl told rescuers, who replied that they desperately wanted to help her.

The rescuers said an excavator was needed to save the girl and others trapped in collapsed buildings. Other images showed a severed bridge and damaged and flattened houses.

The earthquake damaged part of a hospital and patients were moved to an emergency tent outside. Rescuers struggled to extract seven patients and staff who were trapped under tons of rubble. After several hours, an excavator came to help and the rescuers eventually retrieved four survivors and three bodies.

Another video showed a father crying, asking for help to save his children buried under their toppled house. “They are trapped inside, please help,” he cried.

Thousands of displaced people were evacuated to temporary shelters.

The quake was centred 36 kilometres (22 miles) south of West Sulawesi province's Mamuju district, at a depth of 18 kilometres (11 miles), the U.S. Geological Survey said.

The Indonesian disaster agency said the death toll climbed to 42 as rescuers in Mamuju retrieved 34 bodies trapped in the rubble of collapsed homes and buildings.

The agency said in a statement that eight people were killed and 637 others were injured in Mamuju's neighbouring district of Majene.

It said at least 300 houses and a health clinic were damaged and about 15,000 people were being housed in temporary shelters in the district. Power and phones were down in many areas.

West Sulawesi Administration Secretary Muhammad Idris told TVOne that the governor's office building was among those that collapsed in Mamuju, the provincial capital, and many people there remained trapped.

Rescuer Saidar Rahmanjaya said a lack of heavy equipment was hampering efforts to clear the rubble from collapsed houses and buildings. He said his team was working to save dozens of people trapped in eight buildings, including in the governor's office, a hospital and a hotel.

“We are racing against time to rescue them,” he said.

Relatives wailed as they watched rescuers pull a body of a loved one from a damaged home in devastated Mamuju. It was placed in an orange body bag and taken away for burial.

“Oh my God, why did we have to go through this?” cried Rina, who uses one name. “I can't save my dear sister ... forgive me, sister, forgive us, God!”

President Joko Widodo said in a televised address that he had ordered his social minister and the chiefs of the military, police and disaster agency to carry out emergency response measures and search and rescue operations as quickly as possible.

“I, on behalf of the Government and all Indonesian people, would like to express my deep condolences to families of the victims,” Widodo said.

The National Search and Rescue Agency's chief, Bagus Puruhito, said rescuers from the cities of Palu, Makassar, Balikpapan and Jakarta were being deployed to help in Mamuju and Majene.

Two ships were heading to the affected areas from Makassar and Balikpapan carrying rescuers and search and rescue equipment, while a Hercules plane carrying supplies was on its way from Jakarta.

Puruhito is already leading more than 4,100 rescue personnel in a separate massive search operation for victims of the crash of a Sriwijaya Air jet into the Java Sea last Saturday.

Among the dead in Majene were three people killed when their homes were flattened by the quake while they were sleeping, said Sirajuddin, the district's disaster agency chief.

Sirajuddin, who goes by one name, said although the inland earthquake did not have the potential to cause a tsunami, people along coastal areas ran to higher ground in fear one might occur.

Landslides were set off in three locations and blocked a main road connecting Mamuju to the Majene district, said Raditya Jati, the disaster agency's spokesperson.

On Thursday, a magnitude 5.9 undersea quake hit the same region, damaging several homes but causing no apparent casualties.

Indonesia's meteorology, climatology and geophysical agency, known by its Indonesian acronym BMKG, warned of the dangers of aftershocks and the potential for a tsunami. Its chairwoman urged people in coastal areas to move to higher ground as a precaution.

Indonesia, a vast archipelago of 260 million people, is frequently struck by earthquakes, volcanic eruptions and tsunamis because of its location on the “Ring of Fire,” an arc of volcanoes and fault lines in the Pacific Basin.

In 2018, a 7.5 magnitude earthquake in Palu on Sulawesi island set off a tsunami and caused soil to collapse in a phenomenon called liquefaction. More than 4,000 people died, many of the victims buried when whole neighbourhoods were swallowed in the falling ground.

A powerful Indian Ocean quake and tsunami in 2004 killed 230,000 people in a dozen countries, most of them in Indonesia.

------

Karmini reported from Jakarta, Indonesia.