New York CNN Business  — 

Papa John’s has reached a truce with its controversial founder and former CEO John Schnatter.

In a settlement agreement filed with the SEC this week, Schnatter said he would step down from the board by the company’s annual meeting, which is scheduled for April 30. In exchange, Schnatter will have a hand in picking a new director.

Schnatter must withdraw some of the lawsuits he has filed against the company, and Papa John’s has to turn over a number of documents Schnatter has demanded, according to the deal. Schnatter, who owns about 30% of the company, remains its largest shareholder.

In a statement, Schnatter said that he is thankful “that we can all focus on the company’s business without the need for additional litigation.” Still, the founder noted that he reserves the right to raise new legal claims against the company if he finds evidence of wrongdoing in the company’s documents.

The deal marks the end of a long, drawn-out battle between Papa John’s and its founder.

Schnatter stepped down as CEO in December 2017, soon after he blamed the NFL leadership’s handling of athlete protests for poor pizza sales. Months later, in July, he resigned as chairman of the company’s board after news broke that he had used the N-word on a conference call.

John Schnatter was photographed for Forbes Magazine in January 2017 in Jeffersonville, Indiana.

But Schnatter soon said that it was a mistake to resign, and that he was being scapegoated.

He said that new CEO Steve Ritchie wasn’t fit for the job and accused him of creating a toxic culture at the company. In a letter to franchisees this summer, the founder said the company is struggling because of “rot at the top.” Papa John’s called the accusations “untrue and disparaging,” characterizing them as “self-serving.” It issued a scorching condemnation of Schnatter in its own letter.

Papa John’s has also taken swift steps to distance itself from Schnatter in the public eye. It removed his image from marketing materials and launched a new ad campaign featuring a diverse panel of franchisees and employees. It also conducted an internal audit on diversity and mandated bias training for its workers.

The battle between Schnatter and the company continued as Papa John’s looked to a hedge fund to help lift it out of a year-long sales slump.

Last month, the company announced a $200 million investment from the hedge fund Starboard Value, with the possibility of another $50 million by March 29. Starboard Value CEO Jeffrey Smith is now chairman of the board.

Around that time, Schnatter submitted his own proposal to the board, saying he was willing to invest up to $250 million in the company, but he withdrew the proposal in light of the Starboard deal. As recently as last week, Schnatter submitted a letter to the company nominating himself to be chairman of the board.

Now, he said, “I’m happy that we were able to enter into this agreement and allow the new leadership … to help Papa John’s regain its strength and market position.”

Turning Papa John’s business around will be tricky. The company has suffered five straight quarters of sales declines. Sales at North American stores open at least a year fell 8.1% in the last three months of 2018, a result Ritchie called “disappointing to all of us,” on a call with analysts. He added that they “continue to reflect the consumer’s sentiment challenges our brand has experienced in the U.S.”