Two mariners who attempted to sail from Honolulu to Tahiti have been rescued after being stranded in their boat for five months.

Jennifer Appel, Tasha Fuiava and their two dogs were rescued Wednesday by the crew of the USS Ashland, an amphibious dock landing ship based in Sasebo, Japan.

The women were spotted on Tuesday by a Taiwanese fishing vessel 900 miles southeast of Japan, according to Honolulu station KHON TV. Crew members contacted the Coast Guard in Guam. It then relayed the news to the USS Ashland, which was deployed in the area.

Appel and Fuiava set sail for Tahiti on May 3, but had an engine casualty amid bad weather a week into their voyage. Still, they continued on by sail.

In June, they began making daily distress calls, but had no luck getting the attention of ships for 98 days straight, according to The Guardian.

“It was very depressing and very hopeless, but it’s the only thing you can do, so you do what you can do,” Appel told reporters.

One night, a group of sharks attacked the boat and one shark returned a day later.

“Both of them, we actually thought it was lights out, and they were horrific,” Appel said. “We were just incredibly lucky that our hull was strong enough to withstand the onslaught.”

Courtesy of US Navy Tasha Fuiava, an American who had been sailing for five months on a damaged sailboat, climbs the ladder to board the amphibious dock landing ship USS Ashland.

The two also dealt with the pain of seeing ships but not being able to make contact, Fuiava told NBC News.

“I could see light and I could see vessels, and once you get closer, we thought it would be close enough to do a [distress] call,” Fuiava said. “When they would turn and keep going, yeah, it was kind of sad.”

Courtesy of US Navy

The ordeal ended Wednesday when the USS Ashland arrived on the scene around 10:30 a.m. Officials assessed the damage to the boat and found it unseaworthy.

The two women and their dogs were aboard the naval vessel by 1:18 p.m.

“I’m grateful for their service to our country. They saved our lives,” Appel said, according to a Navy press release. “The pride and smiles we had when we saw [U.S. Navy] on the horizon was pure relief.”

Appel and Fuiava were able to survive the five months of being stranded, thanks to water purifiers and a year’s worth of food they packed before sailing ― mostly dry goods like oatmeal, pasta and rice.

Once aboard the ship, Appel and Fuiava received medical assessments, food and a place to sleep. They will remain aboard the Ashland until the ship’s next port of call.

“The U.S. Navy is postured to assist any distressed mariner of any nationality during any type of situation,” Cmdr. Steven Wasson, Ashland commanding officer, said in the release.

📺🔊: #USSAshland rescues two mariners and their dogs stranded in Pacific Ocean for months - https://t.co/u4ntPRLtHL via @Amphib7FLT pic.twitter.com/t7e50EwTjt — U.S. Navy (@USNavy) October 26, 2017

Currently, the sailboat is adrift, but Appel and Fuiava hope another ship finds it and it can be repaired.

Meanwhile, Appel said the ordeal hasn’t sworn her off planning a future ocean journey.

“Well, you gotta die sometime,” Appel told ABC News.“You may as well be doing something you enjoy when you’re doing it.”