ST. PETERSBURG, Fla. (AP) — Justin Wilson spent the long IndyCar offseason in limbo. He waited patiently for an opportunity for a full-time ride, and each time he thought he was close, the deal fell apart.

It was an agonizing six months for the British driver, who was left without a ride as drivers swapped seats and signed new deals.

Wilson still doesn't have a steady ride, but on Friday came the best available option: A two-race deal with Andretti Autosport to run the Indianapolis 500 and the Grand Prix of Indianapolis. Michael Andretti's organization won the 500 last season with Ryan Hunter-Reay.

"It's a great opportunity, and that was the one thing when I looked back, how do I want to plan my future and what's the next career move?" Wilson said. "Michael has put together such a great outfit and great team, and they are always so competitive at the 500. That's the one race that every driver wants to win. It's just two races — but it's two of the best races.

"The Indy 500, it's the one race in your career, if you win that, it changes everything. So this was giving myself the best chance of winning."

The deal with Wilson was facilitated by Honda, which wanted Wilson in its car. But Andretti said the team is still looking for sponsorship that could secure more races this season for Wilson.

In fact, the organization was close multiple times on landing financial backing that could have had Wilson in a fourth car for Andretti. The team currently fields full-time cars for Marco Andretti, Carlos Munoz and Hunter-Reay.

"It was a roller-coaster. We had two or three deals that we thought were there," Andretti said. "They fell apart at the last minute. It was an emotional ride for me as it was for him."

For Wilson, he said his situation changed weekly. Adding to his frustration was a business decision made by Michael Shank Racing to leave Wilson off the roster for the Rolex 24 at Daytona sports car race. When he was put back into the lineup for the Twelve Hours of Sebring last weekend, the car retired before Wilson even drove one stint.

"You think things are coming together, then it would slip away, then it would come back again, then it would slip away," he said. "It seemed like every four, five days it would change. I saw this as a test of how determined am I to be racing? How determined am I to be racing in IndyCar?

"What else can you do? You can either give up and quit and leave, or you can keep pushing, try and fight for a place to be here on the grid."

The season opens Sunday at St. Petersburg, where Wilson will be a spectator.

The 11-year IndyCar veteran has seven career wins and 26 podium finishes, but his ride with Dale Coyne Racing went away at the end of last season because of a lack of funding.

With Coyne, where he drove for three seasons, Wilson had one win and five podiums. He was also a career-best fifth in the 2013 Indianapolis 500.

Wilson spent the bulk of the offseason rumored to be in contention for a fourth car at Andretti, but without sponsorship, the deal couldn't be completed.

Andretti, though, is working with both Wilson and Simona de Silvestro this year to put together at least partial programs. The team will field a fourth car Sunday for de Silvestro, and Andretti said he's still trying to field five cars in the Indy 500.

He had five entries last season when Hunter-Reay won, and Wilson puts him at four cars.

"The goal is to run five cars for sure in Indianapolis," Andretti said. "Just like Justin, we are pushing hard on (de Silvestro) as well, to try to get her in the car for more than just this race. We are hoping we can put something together."