The United Nations has announced that 50 countries have ratified a UN treaty to ban nuclear weapons, triggering its entry into force in 90 days.

The move has been hailed by anti-nuclear activists but strongly opposed by the United States and the other major nuclear powers.

As of Friday, the treaty had 49 signatories, and the United Nations said the 50th ratification from Honduras had been received.

UN Secretary-General Antonio Guterres commended the 50 states and saluted "the instrumental work" of civil society in facilitating negotiations and pushing for ratification, UN spokesman Stephane Dujarric said.

Mr Dujarric added the UN chief said the treaty's entry into force on January 22 culminates a worldwide movement "to draw attention to the catastrophic humanitarian consequences of any use of nuclear weapons" and "is a tribute to the survivors of nuclear explosions and tests, many of whom advocated for this treaty."

Mr Guterres also said the treaty "represents a meaningful commitment towards the total elimination of nuclear weapons, which remains the highest disarmament priority of the United Nations."

The treaty requires that all ratifying countries "never under any circumstances ... develop, test, produce, manufacture, otherwise acquire, possess or stockpile nuclear weapons or other nuclear explosive devices".

It also bans any transfer or use of nuclear weapons or nuclear explosive devices, and the threat to use such weapons, and requires parties to promote the treaty to other countries.

Once it enters into force all countries that have ratified it will be bound by those requirements.

The United States had written to treaty signatories saying the Trump administration believes they made "a strategic error" and urging them to rescind their ratification.

The US letter, obtained by The Associated Press, said the five original nuclear powers (the US, Russia, China, Britain and France) and America's NATO allies "stand unified in our opposition to the potential repercussions" of the treaty.

It says the Treaty on the Prohibition of Nuclear Weapons (TPNW) "turns back the clock on verification and disarmament and is dangerous" to the half-century-old Nuclear Nonproliferation Treaty (NPT), considered the cornerstone of global nonproliferation efforts.

The NPT sought to prevent the spread of nuclear arms beyond the five original weapons powers.

It requires non-nuclear signatory nations to not pursue atomic weapons in exchange for a commitment by the five powers to move toward nuclear disarmament and to guarantee non-nuclear states' access to peaceful nuclear technology for producing energy.

UN Secretary-General Antonio Guterres said in an Associated Press interview on Wednesday: "It is clear for me that we will only be entirely safe in relation to nuclear weapons the day where nuclear weapons no longer exist."