New Zealand has passed legislation to allow people who were previously convicted of homosexual offences to have their criminal records wiped.

Currently men who were convicted before homosexuality was decriminalised in 1986 still have the offence listed on their official records.

About 1,000 people will be eligible to have their records cleared when the scheme kicks in next year.

Lawmakers also apologised to those previously affected by the convictions.

Justice Minister Andrew Little said the legislation "sends a clear signal that discrimination against gay people is no longer acceptable, and we are committed to putting right wrongs from the past".

"I would like to apologise again to all the men and members of the rainbow community who have been affected by the prejudice, stigma and other negative effects caused by convictions for historical homosexual offences," Mr Little said.

The government said the convictions relate to three offences that were decriminalised in 1986 - sodomy, indecency between males and keeping a place of resort for homosexual acts.

Family members will be able to apply to have the records of deceased relatives cleared.

To qualify, the sex that led to the conviction must have been consensual and between people aged 16 years or older.

A petition to quash historical convictions for homosexual offences was first introduced to parliament last year.

New Zealand passed laws banning discrimination against gays in 1993, and became the first country in the Asia-Pacific region to legalise same-sex marriage twenty years later.