RALEIGH, N.C. — The North Carolina prison system must recognize humanism as a faith group and allow its adherents behind bars to meet and study their beliefs, a federal judge has ruled in an order released Thursday.

The American Humanist Association and a North Carolina inmate serving a life sentence for murder sued state Department of Public Safety officials in 2015. They accused prison leaders of violating the religious establishment and equal protection clauses of the Constitution by repeatedly denying recognition the requests of the inmate, Kwame Jamal Teague.

In the order, U.S. District Judge Terrence Boyle wrote that prison officials failed to justify treating humanism differently from those religions that are recognized behind bars. Boyle also ordered the state to adjust its computer system so prisoners who declare themselves humanists can be registered under that group.

Federal prisons began recognizing humanism as a faith group in 2015 after similar litigation was filed.

Roy Speckhardt, executive director of the American Humanist Association, praised Boyle’s decision.

“Humanist inmates have the same constitutional rights to study and discuss their values in a group as other religious inmates do,” Speckhardt said in a statement.

The association describes humanism as a nontheistic belief system advocating rational thinking and living ethically for the greater good of society.

The judge’s order noted that state prison authorities keep a list of approved faith groups, providing them time and space for study and worship. But Boyle’s order noted that there were no written standards in that department designed to define what comprises a faith group.

A prison department committee that makes decisions on religious practices had previously rejected Teague’s application for several reasons over time, including that humanism appeared to be “a philosophy of life” rather than a religion practice, according to court filings. The judge’s ruling said the committee had determined humanism appeared to lack a religious structure that included a hierarchy of religious leaders. The committee, however, did allow Teague to study humanism on his own and receive pastoral visits.

Boyle, in the order dated Wednesday, said the department had approved other faith groups that lacked a formal structure or centralized head, such as Hinduism, Rastafarianism and American Indian religion. State officials “have not demonstrated a secular purpose for denying humanism recognition as a religious group or for the decision to prohibit humanist inmates from organizing group meetings,” Boyle wrote.

Pamela Walker, a department spokeswoman, wrote late Thursday in an email that the agency needs to review the ruling before deciding on its next steps, such as a possible appeal.

Teague and the association identified at least eight inmates other than Teague who are humanists and association members, according to Boyle’s order. There are more than 37,000 people in North Carolina state prisons. Teague previously designated himself as Muslim but later changed to Buddhist because it was the only nontheistic option other than “none,” the ruling said.