WILMINGTON, N.C. (AP) — The University of North Carolina at Wilmington has reached a half-million-dollar settlement with a professor who announced his retirement amid backlash over his comments on social media, which included calling the state’s governor “Massa Cooper.”

In an email sent to faculty, staff and students, UNCW Chancellor Jose Sartarelli on Thursday announced that Mike Adams, a sociology and criminology professor at UNCW, would receive $504,702 for lost salary and lost retirement benefits. The payment was approved by N.C. Attorney General Josh Stein and the UNC Board of Governors, according to Sartarelli.

Sartarelli said the school was faced with three choices, including retaining Adams as a faculty member and accepting the ongoing disruption while hurting the UNCW community and the school itself. Another choice was to attempt to fire Adams and face a lengthy legal process six years after the professor won a First Amendment lawsuit in 2014 that cost the school approximately $700,000, Sartarelli said.

“Losing a similar lawsuit today could cost even more,” he said.

Sartarelli said a conversation with Adams revealed he was interested in retiring, which led to a settlement which he said was “the best option for our university and our community.”

“In addition to saving money, the settlement will prevent the continued disruption to our educational mission, reduce concerns around campus safety, and lessen the harm to the institution,” Sartarelli said. “Dollars are precious, but our institutional integrity is priceless.”

The latest controversy began in late May when Adams, who is white, tweeted that he dined with six men at a six-seat table and “felt like a free man who was not living in the slave state of North Carolina.” He then wrote: “Massa Cooper, let my people go!”

In 2016, Adams posted an article about a student activist under the title “A ‘Queer Muslim’ Jihad,” The News & Observer of Raleigh reported at the time.

Faculty members at the University of Montana later opposed Adams’ visit to their school, writing that he had “a long record of mocking, demeaning and verbally attacking women, people of color, members of the Islamic faith and the LGBTQ community,” the newspaper reported.