JAKARTA (Reuters) - A powerful earthquake struck near Indonesia’s Moluccas islands on Thursday, prompting panicked residents to flee to higher ground, though a tsunami alert was later lifted and there were no immediate reports of casualties.

The quake had a magnitude of 7.1 and its epicentre in the sea was 139 km (86 miles) northwest of the city of Ternate at a depth of 45 km, according to the U.S. Geological Survey. More than 20 aftershocks occurred.

Indonesia’s geophysics agency lifted the tsunami warning after two hours because it detected only small waves in Ternate, Jailolo and Bitung.

Miftahudin, an official in Jailolo in the Halmahera area of the Moluccas, said residents had fled to the hills.

“After the earthquakes, there was an electricity blackout,” he told news portal Tribunnews. There had been no reports of fatalities or damage in the area, he said.

The quake was also felt strongly on the island of Sulawesi, to the west of the epicentre, where authorities urged people to move to higher ground and stay away from the beaches.

Indah Lengkong, a resident of the port city of Bitung in North Sulawesi, said by text message: “The house was visibly shaking.”

People in her neighbourhood had initially panicked, she said, adding: “The quake was very strong and lasted for a while. We can still feel tremors but weaker.”

Tremors shook buildings in cities across North Sulawesi.

Indonesia is situated on the so-called Pacific Ring of Fire, which frequently has earthquakes and sometimes accompanying tsunamis.

A magnitude 7.3 earthquake had struck the Moluccas islands in July, killing at least four people.The most devastating in recent Indonesian history was on Dec. 26 2004 when a magnitude 9.5 quake triggered a massive tsunami that killed around 226,000 people along the shorelines of the Indian Ocean, including more than 126,000 in Indonesia.

Last year, a tsunami hit the city of Palu in Sulawesi, killing thousands.