Communist Party leaders gathered in Hanoi Friday to mark the 40th anniversary of the Paris Peace Accords, the culmination of painstaking talks that eventually ended America’s direct military involvement in Vietnam.

Thousands of people attended the ceremony in the country’s capital to celebrate the signing of the 1973 deal, which ended decades of war with the U.S. and brought a temporary halt to fighting between North and South Vietnam.

Speaking to a packed hall of Communist Party delegates, President Truong Tan Sang described the negotiations as “the longest, most difficult diplomatic struggle for Vietnam.”

The deal, signed on Jan. 27, 1973 — 40 years ago this Sunday — represents “Vietnam’s diplomatic victory in its struggle against the United States,” Sang added after watching a dance re-enactment of the communists’ wartime victories.

Talks to end the U.S.-Vietnam War opened in Paris on May 10, 1968, with the U.S. delegation hopeful of reaching a quick deal.

Instead, negotiations dragged on for five years, during which the war escalated as both sides adopted a strategy of “fighting while talking,” hoping to translate battlefield wins into bargaining power.

The communists, determined to reunify Vietnam, were ready to bide their time while U.S. leaders were weakened by the domestic antiwar movement and cut troop numbers year-by-year, reducing their diplomatic clout.

Nguyen Thi Binh, a former vice state president who was a key negotiator, hailed the agreement as “a strategic victory that led to the 1975 victory, liberated South Vietnam and reunified the country.”

The deal saw all sides agree to a ceasefire and the U.S. pledge to withdraw troops within 60 days while its prisoners were granted freedom.

North and South Vietnam also agreed to work peacefully toward national reunification.