AP photo by John Raoux / NASCAR Cup Series team owner Chip Ganassi, left, and driver Jamie McMurray celebrate after McMurray won the Daytona 500 in February 2020.

CHARLOTTE, N.C. — Chip Ganassi sold his NASCAR team to Justin Marks, owner of Trackhouse Racing, and declared Wednesday that he will pull out of the nation's top stock car series at the end of this season.

Ganassi fields two cars in the Cup Series but will transfer his NASCAR shop and its assets to Marks for 2022.

"He made me a great offer that required my attention. The team wasn't for sale," Ganassi told The Associated Press. "I'm not out of racing, I'm just out of NASCAR. I still have an IndyCar team. I still have an IMSA sports car team. I still have a Formula E team. I had an offer that I was required to consider."

The sale was announced at the NASCAR Hall of Fame, where Ganassi said "if I was trying to sell my team, I would have talked to everybody that was looking for a charter or looking for a team or looking to get involved in the sport. I did not. I talked to one person."

Marks said he called Ganassi out of the blue to make his pitch.

"I think there's a lesson here that sometimes you just have to make the call, and that's what I did: I said 'I'm in the process right now, we're at a point in time where I'm trying to identify opportunities to grow in this space and to a create a great future for Trackhouse,'" Marks told AP.

Marks, who drove 22 Xfinity Series races for Ganassi from 2016 through 2018, said the team owner was intrigued.

"He was interested in hearing what I had to say," Marks said. "I think maybe he didn't know how serious I was. We had a great conversation that day."

A pair of charters went for at least $10 million each two weeks ago, but in addition to two charters, Marks also gets the Ganassi shop and assets inside the building in Concord, North Carolina. Marks declined to discuss terms of the deal, which was completed last week.

Trackhouse Racing, which counts entertainer Pitbull as a co-owner, is in its first season. The team leased a charter this year from Spire Motorsports to allow Daniel Suarez to run a full schedule, but Marks had been unable finalize a deal to purchase NASCAR's equivalent of a franchise.

Marks has said he lost out on three charters last year as he was building Trackhouse — on Wednesday he said he has bid on four total charters since entering NASCAR — and has balked at paying the current eight-figure asking price for one in a red-hot market. He instead bought an entire organization in a deal that includes both of Ganassi's charters.

"This acquisition provides Trackhouse a platform for years to come, enabling us to field multiple teams, elevate our on-track performance, deliver great value for our sponsors and partners, build lasting community impact programs and continue to grow our brand beyond the sports conversation," Marks said.

Marks has said he not only wanted to expand Trackhouse to a two-car team but also move the organization to Nashville by 2023 and operate from the heart of Music City's entertainment district, downtown in the Tennessee Capital. He said Trackhouse will be based in Ganassi's current shop in 2022 and future plans are under discussion.

Ganassi said NASCAR has had an infusion of interest from new team owners, citing Marks but also 23XI Racing co-owners Denny Hamlin, who still drives for Joe Gibbs Racing, and basketball legend Michael Jordan. Jeff Gordon last week was given a new role at Hendrick Motorsports that positions the Hall of Fame driver to eventually take over the four-car team that is the all-time leader in NASCAR wins. Brad Keselowski is in his final year driving for Team Penske but is expected to move to Roush Fenway Racing in a role that gives him an ownership stake.

"I felt there was a lot of energetic thought being put into what Justin was saying," Ganassi said. "With all the new blood that seems to be coming into (NASCAR) ... the sport is ready for a new group. We talk about a new generation of drivers, but I think you're going to see a new generation of owners."

Marks said Trackhouse next year will field two cars, with Suarez joined by a driver to be named later, and Marks added that current CGR drivers Kurt Busch and Ross Chastain are the leading candidates. He also said all current CGR employees in the NASCAR program will be considered for retainment, but Ganassi said his executive management team will stay with him.

"Chip has built an iconic motorsports empire and the Ganassi brand is globally recognized as a winner in the auto racing industry," Marks said. "It is truly an honor that we can build from that foundation."

Ganassi has been a fixture in motorsports for nearly 40 years dating to his driving days, when he qualified for the Indianapolis 500 in 1982.

Chip Ganassi Racing began as an open-wheel team that grew into one of the most successful organizations in IndyCar. The Pittsburgh-based owner expanded into NASCAR in 2001 and has fielded at least two cars every season since.

CGR won the Daytona 500 and the Brickyard 400, two of the biggest races in NASCAR, with Jamie McMurray in 2010. He currently fields a pair of Chevrolets for Busch and Chastain; Ganassi told them of the sale on Wednesday.

Ganassi's IndyCar team is a four-car program that features six-time series champion Scott Dixon and current points leader Alex Palou. He will run his organization from its Indianapolis shop next season. Ganassi's corporate office in Pittsburgh.

Overall, CGR teams have 19 championships and more than 230 victories, including four in 2021. His wins include four at the Indianapolis 500, eight at the Rolex 24 At Daytona, the 12 Hours of Sebring and 24 Hours of Le Mans.