The first U.S. warship to visit New Zealand in more than 30 years was changing course Tuesday to help evacuate people stranded in a coastal town following a powerful earthquake.
Hundreds of tourists and residents remained stranded in the town of Kaikoura and faced a third disrupted night after a powerful quake early Monday cut off train and vehicle access.
New Zealand military officials said they were on target to evacuate about 200 people by helicopter on Tuesday as a major rescue operation unfolded.
New Zealand Defense Minister Gerry Brownlee said that the USS Sampson was heading south to Kaikoura and would be able to deploy two helicopters to help in the evacuation.
The destroyer had been due to sail into Auckland on Wednesday as part of 75th anniversary celebrations for the New Zealand navy.
The visit by the U.S. ship is significant because it ends a 30-year-old military stalemate between the countries that was triggered when New Zealand banned nuclear warships.
Brownlee said Australia was also diverting the HMAS Darwin to Kaikoura.
"Despite the changes to the planned celebrations, it's poignant to see the anniversary marked with such cooperation and camaraderie," Brownlee said in a statement.
The operation comes as several buildings in Wellington, New Zealand's capital, were evacuated and streets cordoned off Tuesday after engineers determined that a nine-story office building was in danger of collapsing.
The magnitude-7.8 quake that struck New Zealand's South Island left two people dead and triggered a small tsunami. It also brought down rocks and mud that swept across highways and cracked apart roads.
The defense force said it had started ferrying people out by military helicopter and that a navy ship from Auckland was due to arrive in the area Wednesday morning.
Home to about 2,000 residents, Kaikoura is a popular destination for travelers taking part in whale-watching expeditions or wanting a stopover with mountain views. But the quake knocked out water supplies and sewer systems and left people with no easy way out.
"From all directions, Kaikoura has essentially been isolated," Air Commodore Darryn Webb, acting commander of New Zealand's Joint Forces, told The Associated Press. "There's a real imperative to support the town because it can't support itself."
Webb said the military was using four NH90 helicopters that could each transport about 18 people at a time out of the town. He said the navy ship could pick up hundreds of people if weather conditions allowed.
"We're going to get as many people and belongings out as quickly as we can," Webb said.
He said the operation could take several days.
Air Force Wing Commander Scott McKenzie said in a statement that military personnel were delivering food, water, diesel fuel and other basic necessities by helicopter. Authorities have prepared about 5 metric tons (5.5 tons) of supplies in the city of Christchurch.
Sarah Stuart-Black, director of the Ministry of Civil Defence and Emergency Management, said the priority was transporting out those people with health issues or bookings on international flights.
She said the community was rallying to help the tourists.
"It's fantastic that some of the locals in Kaikoura have taken in tourists into their own homes," she said.
In Wellington, Brendan Nally, the regional commander for the New Zealand Fire Service, said engineers were completing an inspection of the nine-story downtown office building on Tuesday when they found that a major vertical beam had failed above the fifth floor.
"It looks somewhat like a broken bone in the leg. It's fractured through," Nally said. "So the building is at significant risk of collapse."
Nally said the building was being renovated and was empty when the quake struck.
He said the buildings evacuated included the national headquarters for the Red Cross, the Thai Embassy, the headquarters for New Zealand Rugby and an Anglican cathedral.
Elsewhere in the capital, many people returned to work after the quake shut down much of the city's center on Monday. But some buildings remained closed, and heavy rain and flooding compounded the difficulties.
Strong aftershocks continued to shake New Zealand, rattling the nerves of exhausted residents.
Police said one person died from the quake in Kaikoura and another in Mt. Lyford, a nearby ski resort. Several other people suffered minor injuries in Kaikoura.
Prime Minister John Key flew over Kaikoura by helicopter Monday as aftershocks kicked up dust from the landslides below. Cars could be seen lying on their sides and parts of the road were clearly impassable.
"It's just utter devastation," Key said.
Three cows whose predicament captured the interest of people around the world after they became stranded on a small island of grass in an area ripped apart by the quake were rescued. The Newshub news service reported that a farmer and some helpers dug a track to them and brought them out.
New Zealand, a country of 4.7 million, sits on the "Ring of Fire," an arc of seismic faults around the Pacific Ocean where earthquakes are common. An earthquake in Christchurch five years ago killed 185 people and destroyed thousands of homes and other buildings.
Associated Press writer Kristen Gelineau in Sydney contributed to this report.