PHILADELPHIA (AP) — Nick Foles contemplated retirement after a miserable season with the Rams in which he ended up losing his starting job to Case Keenum.

That’s just one spin of a unique quarterback carousel that’ll be on display when Foles and the Philadelphia Eagles (14-3) host Keenum and the Minnesota Vikings (14-3) in the NFC championship game Sunday.

gettyimages 500209450 Nick Foles And Case Keenum Have Strong Career Connections

ST. LOUIS, MO – DECEMBER 6: Nick Foles #5 of the St. Louis Rams throws a pass in the first quarter against the Arizona Cardinals at the Edward Jones Dome on December 6, 2015 in St. Louis, Missouri. (Photo by Dilip Vishwanat/Getty Images)

“It pretty wild,” Foles said. “Case’s success and the way he plays doesn’t surprise me because him and I were together and we prepared together. We were around each other every day. But I think the big message there is no matter what happens, you’ve just got to keep believing in yourself, keep working hard and just never give up.”

gettyimages 621518460 Nick Foles And Case Keenum Have Strong Career Connections

LOS ANGELES, CA – NOVEMBER 06: Quarterback Case Keenum #17 of the Los Angeles Rams calls for a huddle during the second quarter of the game against the Carolina Panthers at the Los Angeles Coliseum on November 6, 2016 in Los Angeles, California. (Photo by Harry How/Getty Images)

The cycle began when former Eagles coach Chip Kelly traded Foles to the St. Louis Rams for Sam Bradford in March 2015. A day later, the Rams acquired Keenum from the Houston Texans to back up Foles.

Foles went 4-7 in 11 starts for the Rams before he was benched for Keenum. Meanwhile, Bradford had a decent season with the Eagles, but was traded to Minnesota a week before the 2016 season opener to pave the way for Carson Wentz. The Vikings needed Bradford to replace the injured Teddy Bridgewater. Bradford had a career year in 2016.

Foles asked for his release from the Rams after they moved to Los Angeles and drafted Jared Goff No. 1, one pick ahead of Wentz. Foles seriously considered hanging up the cleats before Andy Reid — who drafted him in third round in Philadelphia in 2012 — persuaded him to join the Kansas City Chiefs as a backup to Alex Smith.

Foles played well in two games in relief and then returned to Philly on a two-year deal to provide insurance behind Wentz this season. Keenum helped groom Goff in Los Angeles last year and then went to Minnesota to back up Bradford.

Keenum stepped into the lineup in September after Bradford was injured and had by far the best season of his career, passing for 3,547 yards, 22 touchdowns and only seven interceptions. Foles took over in Philadelphia after Wentz tore his ACL in Week 14.

Now, the former teammates are one win away from starting in the Super Bowl.

“I know this is what all of you guys predicted back in the day, a Foles vs. Keenum NFC championship,” Keenum joked. “So good job to all of you guys who predicted that.”

The Eagles are fortunate Foles chose to keep playing a year ago.

gettyimages 904601016 Nick Foles And Case Keenum Have Strong Career Connections

PHILADELPHIA, PA – JANUARY 13: Nick Foles #9 of the Philadelphia Eagles celebrates after LeGarrette Blount #29 scored a 1 yard touchdown against the Atlanta Falcons during the second quarter in the NFC Divisional Playoff game at Lincoln Financial Field on January 13, 2018 in Philadelphia, Pennsylvania. (Photo by Abbie Parr/Getty Images)

“I talked a lot to my wife and I remember just saying a prayer,” Foles recalled. “Going to back to play for coach Reid, I am a better person because of that decision. It wasn’t an easy decision. But I leaned on my wife, I leaned on my family and I leaned on my faith in those moments, and I’m very grateful I made the decision.”

Foles started six games his rookie season, going 1-5 on a 4-12 team that got Reid fired after 14 seasons in Philadelphia. He began 2013 as the backup to Michael Vick in Kelly’s first season in the NFL and ended up having a sensational year, leading the Eagles to an NFC East title.

He threw 29 TDs and only two picks — including playoffs — and posted a passer rating of 119.2, third highest in league history. He tied an NFL record with seven TD passes in a game at Oakland in November 2013.

Foles wasn’t quite as spectacular in 2014, but the Eagles were 6-2 in his eight starts. He tossed 13 TDs, 10 interceptions and missed the final eight games after breaking his collarbone.

Then he went to St. Louis and struggled on another one of Jeff Fisher’s losing teams. Keenum, an undrafted free agent in 2012 who bounced around from with the Texans and Rams, also didn’t have much success playing for Fisher. Neither did Goff. All three have thrived playing for other coaches.

Case Keenum #7 of the Minnesota Vikings celebrates after a touchdown against the New Orleans Saints during the first half of the NFC Divisional Playoff game at U.S. Bank Stadium on January 14, 2018 in Minneapolis, Minnesota.

Case Keenum (Photo Credit: Jamie Squire/Getty Images)

“You’ve just always got to believe and you always have to prepare,” Foles said. “Sometimes things happen where unfortunately guys get injured and you have to step in and it’s your job to lead the team. (Keenum) has really done an amazing job. It doesn’t surprise me. That was my job stepping in for Carson to lead this team like I have before.”

Foles completed 77 percent (23 of 30) for 246 yards in a 15-10 win over Atlanta last week.

Keenum, 9-15 as a starter before joining the Vikings, followed his breakout season by leading Minnesota to an improbable comeback win against the Saints, tossing a 61-yard TD pass to Stefon Diggs as time expired.

The two quarterbacks are good friends off the field.

“Nick is a great guy,” Keenum said. “Great faith, great family. My wife and his wife are great friends. His entire family are good people. Great football player. Prepares well, extremely talented, big arm and he’s really, really athletic, too. I know he’s got a lot of confidence and I’m looking forward to playing against him.”

(© Copyright 2018 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)