VANCOUVER - Sirens and officials banging on doors roused people from their sleep in the middle of the night Tuesday in British Columbia as a tsunami warning was issued along a large swath of the province's coastline after a powerful earthquake off Alaska's coast.

The warning was lifted about three hours later, ending a tense period for some as they made their way to safety on higher ground.

“I just heard the fire trucks going around, honking their horns and on the loud speaker saying there is a tsunami warning,” said Gillian Der, a University of British Columbia geography student who is studying in Queen Charlotte on Haida Gwaii. “It was very apocalyptic. So I was just running up the street to the muster station, up the big hill.”

Josie Osborne, the mayor of Tofino on the west coast of Vancouver Island, was ready in a few minutes to leave her home after getting a warning text but said she pondered what shoes to wear in case she wouldn't ever be back.

When the warning was lifted it “was a great sense of relief. You prepare for the worst and you hope for the best and that's what happened,” she said.

The quake with a magnitude of 7.9 struck at about 1:30 a.m. Pacific time. It was centred 278 kilometres southeast of Kodiak in the Gulf of Alaska at a depth of about 10 kilometres.

Earth sciences Prof. Brent Ward of Simon Fraser University said the tremblor didn't produce a tsunami because it was a strike-slip earthquake, where the plates slip sideways past each other.

“To get a tsunami, you have to have vertical movement of the sea floor and that more often occurs in what we call a thrust fault ... where one of the plates is moving over top of the other.”

Ward said when a plate moves up very quickly, that displaces the water above it, setting off a tsunami.

“It looks as though this earthquake was triggered on what we would call a transcurrent fault in the oceanic plate that is going underneath North America,” he said.

The U.S. Geological Survey said dozens of aftershocks have been recorded ranging in magnitude from 3.3 to 6.9.

It says large earthquakes are common in the region and over the previous century 11 other quakes of magnitude seven or greater have occurred within 600 kilometres of Tuesday's event.

Public Safety Minister Mike Farnworth said several B.C. communities activated their emergency plans and evacuated those at risk as the provincial emergency co-ordination centre and five regional operations centres were also mobilized.

In low-lying areas of Victoria and Esquimalt, officials went door-to-door telling people to evacuate, while elsewhere sirens and text alerts were used to get the warning out, he said in an interview.

An alert was still in place hours after the initial warning, which means there may be higher wave action in low-lying areas along the coast, Farnworth said.

“Although the tsunami warning was eventually suspended, this event demonstrates that coast warning systems do work.”

Patricia Leidl, communications director with Emergency Preparedness BC, said there was a three centimetre wave and a 15 centimetre rise in sea level hours after the quake at Tofino.

The tsunami warning covered B.C.'s north coast, Haida Gwaii, the west coast of Vancouver Island, the central coast and northeast Vancouver Island, and along the Juan de Fuca Strait.

The last devastating tsunami to hit B.C. was 54 years ago in Port Alberni after a 9.2 earthquake off Alaska. Two waves gathered force as they raced up the funnel-like Alberni Inlet in March 1964, hitting the city with forces that swept away houses and vehicles, but caused no deaths.

Scientists in Japan, and Vancouver Island First Nations, have gathered accounts of a huge earthquake and tsunami in January 1700 that wiped out communities and killed thousands of people. A wave the height of a four-storey building hit the east coast of Japan nine hours after the original earthquake off the B.C. coast.

People in Alaska received warnings Tuesday from the National Weather Service sent to cellphones that said: “Emergency Alert. Tsunami danger on the coast. Go to high ground or move inland.”

The fire chief of a city in Alaska that is popular with cruise ships said there was no panic as residents reacted to the tsunami warning.

Seward fire Chief Eddie Athey praised his community for doing “the right thing,” calling it “a controlled evacuation” as people left for higher ground or drove along the only road out of the city.

Athey told the Associated Press the quake was gentle, and that it “felt like the washer was off balance.”

The quake lasted for up to 90 seconds, long enough that he thought, “Boy, I hope this stops soon because it's just getting worse.”

The Alaska Earthquake Information Center said the quake was felt widely in several communities on the Kenai Peninsula and throughout southern Alaska, but it also had no immediate reports of damage. People reported on social media that the quake was felt hundreds of kilometres away, in Anchorage.

- With files from The Associated Press