Negotiations to form the Trans-Pacific Partnership free trade agreement began in 2005 and it was signed on Friday.
It's been a long, hard road for the nations involved.
There were 12 when the TPP was signed last year, and the fact that 11 of them had achieved a free trade deal which included the United States was celebrated.
It didn't last - Donald Trump had vowed to take the US out of it and he did that soon after becoming president.
One of the conditions of the TPP was that it couldn't come into force unless the US was part of it, so the other 11 had to renegotiate it.
The outcome was the Comprehensive Progressive Trans-Pacific Partnership, signed by Trade Minister David Parker in Chile.
The previous and the current government faced significant public opposition to the original and the renegotiated agreement.
Anti-free trade activists used the investor-state dispute settlement provisions, ISDS, as their reason to claim New Zealand was "selling its sovereignty".
That was despite the fact that ISDS clauses have been in New Zealand's trade agreements with 13 countries in the last 27 years, and it has never been sued by a foreign company.
As recently as Thursday, opponents were voicing fears about ISDS provisions.
"New Zealand needs to wake up to the fact that signing the TPPA is a moment of constitutional change by stealth, whereby future governments will be forced to march to the beat of foreign investors rather than their economic mandate," said Oliver Hailes, spokesman for Our Future, a network of opponents.
There are ISDS clauses in New Zealand's existing trade agreements with China, Singapore, Thailand, Malaysia, Taiwan and the member countries of the Association of South East Asian Nations.
They are common in trade agreements around the world, and set out basic protections for investing companies.
The law firm Bell Gully says they typically include:
* National treatment (foreign investors are entitled to treatment that is no less favourable than that accorded to domestic investors)
* Most favoured nation' status (foreign investors are entitled to treatment that is no less favourable than that accorded to investors from any other foreign state, usually under another trade agreement)
* Freedom from expropriation (the state may not nationalise or expropriate the property of a foreign investor without paying compensation)
* Fair and equitable treatment (a broad standard incorporating notions of due process, legitimate expectation, and access to justice).
Of those concerns, the most serious is nationalisation or expropriation, which has happened to oil companies in several countries.
If a state breaches those standards, a foreign investor can take action to protect its investment.
Most ISDS clauses provide for the dispute to be resolved by a neutral arbitration panel which can award damages to compensate a foreign investor, but can't punish the state.
Labour, in opposition, campaigned against ISDS clauses and when it came into power tried to remove them from the CPTPP.
Trade Minister Parker partially succeeded by making separate agreements not to use ISDS with five of the 11 countries.
One of those is Australia, which accounts for 80 per cent of New Zealand's foreign investment.
Parker says there is now very little risk of New Zealand being sued.
By gaining the changes, Labour has secured the support of NZ First for legislation that will be needed to ratify the CPTPP.
The Greens still oppose it, so the government will need National's support.
It will be available when the time comes - National says there's hardly any difference between the TPP and the CPTPP.