A U.S. aircraft carrier, USS Carl Vinson, arrived at a port in Danang, Vietnam, on March 5 for the first time in nearly five decades. (AP)

Armed Vietnamese soldiers watched as an American aircraft carrier approached their country’s coastline Monday for the first time in more than four decades. The vessel was on a mission of diplomacy, not war.

The port call involving nearly 6,000 sailors marks the largest U.S. presence in Vietnam since the 1975 U.S. withdrawal after years of combat — a stark picture of how China’s solidifying grasp of the strategic South China Sea has prompted Vietnam to rethink its defense alliances in the region.

“This is a historic day, and we are honored to receive such a warm welcome here,” Rear Adm. John Fuller, the strike group commander, said in a statement.

The four-day port call led by the carrier USS Carl Vinson is part of an ongoing U.S. effort to court Vietnam.

Defense Secretary Jim Mattis visited the country in January to tout strengthening ties on the heels of a new strategy to refocus defense efforts on big-power militaries. He called on the Pentagon to keep pace with a resurgent Russia and China by building relationships in key regions such as Southeast Asia.

Vietnam, increasingly emboldened to challenge Chinese territorial claims in the resource-rich sea, is a critical component of the strategy to further develop military relations, Mattis said on his visit. “We recognize that relationships never stay the same. They either get stronger or they get weaker,” he told his counterpart, Ngô Xuân Lịch, in January, in what could be understood by Beijing as a reference to its often-strained relations with Hanoi.

“America wants a stronger relationship with a stronger Vietnam,” Mattis added. Military relationships between the nations are taking shape. Last year, the United States sold the country a Coast Guard cutter that officials said became the largest ship in its fleet.

China has claimed nearly all the South China Sea. It has chiseled military outposts and runways from rock, and claimed dominion over islands and waterways where $3 trillion in trade flow every year, triggering condemnation from an international tribunal ignored by Beijing. Vietnam’s claims of fishing and navigational waters and a smattering of islets off its coast considerably overlap with China’s disputed claims, leading to occasionally tense standoffs.

Vietnam navigates a complicated relationship defined by geography and its history with China. Vietnamese diplomats have been adept at pushing back on Chinese expansion while keeping military and economic relations mostly healthy, Zack Cooper, an Asia security analyst at the Washington-based Center for Strategic and International Studies, told The Washington Post in January.

Vietnam now stands mostly alone among the Philippines, Malaysia, Brunei and Taiwan in challenging China’s claims. After Philippine President Rodrigo Duterte acquiesced to Chinese pressure to back down on claims in the area, a spokesman for the longtime U.S. ally called the issue “America’s problem.”

Territorial claims in the South China Sea. Vietnam is represented in blue, and China in red. (Center for Strategic and International Studies)

The United States has no territorial claims in the sea but conducts what the military calls “routine and regular” patrols through its waters.

The nuclear-powered USS Carl Vinson, a carrier from San Diego’s 3rd Fleet, arrived off Danang with a deck full of more than 70 aircraft, accompanied by a U.S. cruiser and a destroyer, Lt. Cmdr. Timothy Hawkins, the strike group spokesman, told The Post on Monday.

The southern port city of Danang was a main arrival point for U.S. forces and logistical support during the Vietnam War. It was also a transit hub for herbicides like Agent Orange, the notorious defoliant used by U.S. forces to destroy dense tree cover and food crops used by insurgents and later strongly linked to physical abnormalities. U.S. forces sprayed 21 million gallons of defoliants over Vietnam from 1961 to 1971, including 12 million gallons of Agent Orange.

About 30 sailors will visit what Hawkins described as an education and recreation center frequented by children with birth and developmental disabilities.

Hawkins carefully parsed the connection between Agent Orange and “disabilities local Vietnamese attribute to the history of the war,” he said. The sailors will play soccer and visit with the children, he added.

U.S.-funded and -led efforts to remove dioxin-contaminated soil at the Danang airport wrapped up in November, at the cost of $110 million, PBS reported. Other cleanups are ongoing.

Mattis also found himself confronting the war’s lingering legacy. In January, he toured a Buddhist pagoda near the site where Sen. John McCain (R-Ariz.) was shot down in 1967 and visited the Defense Department agency in Hanoi responsible for identifying and recovering missing and imprisoned troops during the war. Mattis publicly thanked Vietnamese officials for their cooperation in the search for remains.

China has laid claim to a number of islands in the South China Sea, building airbases on tiny spits of land while installing powerful radar and missile launchers. Here's why. (Jason Aldag,Julie Vitkovskaya/The Washington Post / Satellite photos courtesy of CSIS)