Alex Palou will remain with Chip Ganassi Racing next season in an agreement that allows the one-time IndyCar champion to test Formula One with McLaren, and Felix Rosenqvist will keep his seat in a pair of Wednesday resolutions to a wild silly season.

Palou and Ganassi have been locked in a feud since July when the team said it had picked up a 2023 option on the Spaniard. Palou refuted the Ganassi claim and said he was instead moving to McLaren Racing.

Ganassi then sued him and the sides used both mediation and the courts to determine which team would claim Palou next year. The first signs that a solution was near came Sunday at the season finale at Laguna Seca Raceway, where Palou won the race and was then elusive on how his contract situation was playing out.

He said he expected to speak to team owner Chip Ganassi and have an answer very soon. It came Wednesday when he tweeted he had come to an agreement to drive the No. 10 next year for a third consecutive season.

Palou said he was grateful Ganassi also will permit him to ”to pursue F1 testing” with McLaren outside of his IndyCar commitments.

Minutes after Palou’s announcement, McLaren announced that Rosenqvist would return to the No. 7 in IndyCar next season. The Swede has been in limbo for months. He had agreed to a deal with McLaren to move to its new Formula E team next season if there was no seat for him in IndyCar.

The Palou saga was holding up McLaren’s plans for its three-car IndyCar lineup, and Rosenqvist decided he no longer wanted to move to Formula E. McLaren held the IndyCar option on Rosenqvist through the end of September and, as the Palou case dragged on, was going to be forced to release him to sign with another team or walk away from the Palou mess and keep Rosenqvist.

”There’s no better way to enter the offseason than with this news,” Rosenqvist said. ”I love this team, and I’m so happy to continue working with all the incredible people I’ve gotten to know over the past two seasons.”

The team is expanding next year to add a third car for Alexander Rossi, and Rosenqvist and McLaren driver Pato O’Ward have grown extremely close in their two seasons as teammates.

”With everything the team has in the pipeline, the continuing relationship with Pato and the addition of Alex Rossi, we are going to bring our A-game for 2023,” Rosenqvist said. ”It will be the most exciting season for me so far.”

More AP auto racing: https://apnews.com/hub/auto-racing and https://twitter.com/AP-Sports