The Cook Islands has removed a law from its Crimes Act that could jail men for having sex with men.
The law - which was never enforced - said the offence of "indecent acts between males" was punishable by up to five years in prison.
People hosting these acts in their premises faced up to 10 years jail under the Crimes Act 1969.
Under the Crimes (Sexual Offences) Amendment Bill - tabled and passed today - any clauses that make consensual sexual acts between men illegal will be removed from the Crimes Act and will come into force on 1 June.
The rainbow community in the Cook Islands says the bill has been a long time coming.
Pride Cook Islands president Karla Eggelton said it was significant moment for the nation.
"It's massive," Eggleton said.
"We are so grateful for all the people and all the organisations throughout our community who have been working tirelessly to make this happen. This is big," she said.
"And I think the message that we want to tell people is: hug your friend, hug your neighbour, hug your niece, hug your daughter, because now we are truly equal."
Legislators passed the amendments after the second and third reading on Friday, April 14 Cook Islands time.
Eggleton said the passing of the bill reflected the Cook Islands' changing society.
All major parties voiced support for the change before the Cook Islands general election last year.
The explanatory note for the bill said there was a growing acceptance to respect privacy and not discriminate against homosexual behaviour.
The bill will also provide more protection for victims of rape.
One provision of the previous law said married women could only be raped by their husbands if they were separated, and this will be removed.
Moves to repeal the anti-rainbow laws in the Crimes Act has faced multiple road blocks and have been in the process since 2017.
In 2019, lawmakers made a u-turn on promises to decriminalise homosexuality after public consultation.
A draft Crimes Bill penned in 2017 had removed "indecent acts between males" and sodomy as crimes, but instead the end result was for sexual acts between women to also be added as a crime.
Select committee chairman and Cook Islands Party member of parliament, Tingika Elikana told Cook Islands News in 2019 there were "concerns" about decriminalising homosexuality.
"There were provisions [on homosexuality] removed from the draft Bill and people said they have got some concerns about it and the committee has taken that into account," Elikana told the paper.
RNZ