A New Jersey Superior Court judge has cleared the way for the release of more than 5,000 racially charged text messages shared by a group of white corrections officers at the Camden County jail.

Keith Bell/Thinkstock

Nine officers were fired after authorities learned of the texts, which also included photos and videos, The Courier-Post reported.

County officials agreed to release the 5,782 messages to the Courier-Post last month following the paper's request under the Open Public Records Act, but a lawyer for one of the officers challenging his termination attempted to block their release. Attorney Stuart Alterman argued an internal affairs investigator coerced Michael Jacob into allowing a search of two phones found in his possession in the jail.

In a Monday hearing, Judge Louis Meloni ruled that officers can't have personal phones in the jail and as such the phones were contraband that didn't require a search warrant. He also rejected arguments that the texts could be withheld as part of a criminal investigation, noting that the investigation was administrative and the materials, therefore, subject to public disclosure.

In a July ruling, Administrative Law Judge Sarah Crowley said the text messages were not sent to African-American officers but targeted fellow jail employees, inmates and "blacks in general." Warden David Owens, who is black, was often the target of the messages that used variations of a common racist term for blacks.

"Every resident of Camden County has the right to know what was being done by corrections officers who broke the rules and exchanged messages that were disgustingly racist and even targeted the inmates whom they were duty-bound to protect," Courier-Post Regional Editor Jason Alt said following Meloni's ruling.

Authorities learned of the texts in November 2014 after an internal affairs investigation found that Jacob had used a contraband phone to record the destruction of an inmate's property during a search.

(Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)