U.S. Defense Secretary Jim Mattis praised Vietnam on Wednesday for supporting U.N. sanctions against North Korea and expressed hope that Washington and Hanoi can build closer defense ties despite being former enemies.

"They've stepped up and aligned themselves with U.N. sanctions," he told reporters flying with him from Jakarta, Indonesia, where he held high-level talks and observed a colorful display of combat skills by Indonesian commandos.

The Pentagon chief's visit comes just days before the 50th anniversary of the Tet offensive, a turning point in the American war against communist North Vietnam. Mattis, who did not serve in that war, said it is not an impediment to current relations.

"This is in our past," he said.

The Tet offensive, named for the Lunar New Year holiday on which it was launched in 1968, was a battlefield failure for the North Vietnamese but a political victory in the sense that it punctured American hopes of winning the war.

Mattis noted Vietnam's proximity to the South China Sea makes the country a key player in disputes with China over territorial claims to islets, shoals and other small land formations in the sea. Vietnam also fought a border war with China in 1979.

"Because of the coastline they have and the position they occupy, they are going to be a foundation for any kind of prosperity" in the region, which is one reason to push now for closer defense relations, he said.

During his visit, Mattis also planned to meet with representatives of a Pentagon organization, the Defense POW-MIA Accounting Agency, that carries out searches for remains of American service members still unaccounted for from the Vietnam war, which ended in 1975.

Later in the week Mattis plans to fly to Hawaii for talks with U.S. commanders and to meet with his South Korean counterpart to discuss the situation with North Korea.

Before he left Jakarta on Wednesday morning, Mattis was treated to a demonstration of counter-terrorism skills by an Indonesian commando group. The commandos showed off their hand-to-hand combat skills and performed a range of exotic moves including lopping off the heads of live snakes and drinking their blood.

Mattis said during his visit to Jakarta that he hoped the U.S. could develop closer ties to the Indonesian military.