The Civil Aviation Authority has lost its bid to be allowed to randomly sample criminal records of pilots.
The Court of Appeal has upheld an earlier ruling made in the High Court in Wellington which found the practice was unlawful.
Earlier this year, the Civil Aviation Authority (CAA) entered into an agreement with the Ministry of Justice which said it would provide the authority with full criminal information on a random set of 100 pilots, five times a year.
After a commercial pilot hid drink driving convictions in 2008, the CAA wanted to identify any criminal convictions which might affect whether a pilot was fit and proper to work.
But the Airline Pilots' Association challenged the lawfulness of that agreement.
In July this year, the High Court ruled the random sampling of records was unlawful.
The CAA fought that ruling in the Court of Appeal, which issued a decision on Friday dismissing the case.
CAA wants to continue testing
The Civil Aviation Authority says it will look at testing pilots for criminal convictions in a lawful way after its random sampling process was deemed unlawful.
Director Steve Douglas says as part of its public interest role it needs to make sure that pilots are fit to work.
The authority will look instead to test people's fitness on an individual basis, rather than a large sample, he says.