Stockton University has gotten off the Showboat roller-coaster.

After months of legal wrangling, political fights, and millions of dollars spent on maintenance and security at the empty building, the university finally sold the former casino property in Atlantic City.

"Stockton is closing this chapter in our history, and moving on to exciting plans for the university's future," Harvey Kesselman, the university's president, said in a statement Friday.

The Philadelphia-based developer Bart Blatstein bought the property for $23 million, inheriting a legal mess but clearing Stockton to move forward with other plans.

"The university is fortunate to have worked with someone with a strong record of successful development and a commitment to Atlantic City, which is important to Stockton," Kesselman said. "It has been a pleasure to work with Bart Blatstein on this successful sale."

The Showboat property was supposed to be a coup for Stockton, which bought it for $18 million in December 2014 with plans to convert it into a residential "Island Campus" for thousands of students.

A legal agreement with the parent company of the Trump Taj Mahal next door restricted the property's use to a casino and hotel. But rival Caesars Entertainment sold Showboat to Stockton with a conflicting covenant that the site could be anything but a casino.

As Stockton's plans unraveled, it entered an agreement to sell the Showboat to Florida developer Glenn Straub, recent buyer of the shuttered Revel casino, for $26 million.

That plan, too, fell apart, with lawsuit followed by lawsuit. Courts cleared Stockton to sell the site, and the university found a new buyer in Blatstein.

In November, as the scheduled closing date neared, the sides agreed to a two-month delay so Blatstein could reap a tax advantage.

That upped the price to $23 million from $22 million, with Blatstein passing on to Stockton some of the tax benefits.

Stockton has announced plans to build a more modest Island Campus at a new site in Atlantic City, working with nonprofit developers to erect a 56,000-square-foot academic building and housing for 500 students.

The New Jersey Economic Development Authority approved $68.3 million in tax breaks for the campus, to be on about six acres at the intersection of Atlantic, Albany, and Pacific Avenues.

Stockton would put about $18 million into the campus.

856-779-3220 @elaijuh