ARLINGTON, Texas (AP)Gardner Minshew had a chance for a Hollywood ending.

Instead, the Philadelphia Eagles will have to wait at least a few more days to clinch the top seed in the NFC.

Filling in for injured starter Jalen Hurts, Minshew accounted for three touchdowns while throwing for 355 yards, but his second interception set up the go-ahead field goal late in Dallas’ 40-34 victory Saturday.

Minshew made his first start this season for the Eagles four days after speaking at the memorial service for his college coach, Mike Leach.

The 61-year-old Leach, who was the coach at Mississippi State, died Dec. 12 of complications from a heart condition. Minshew played for Leach at Washington State.

Minshew had Philadelphia 19 yards from a potential winning touchdown in the final seconds, but his desperation pass into the end zone on fourth-and-10 wasn’t anywhere near a receiver.

”There was a lot going on,” said Minshew, who had two scoring tosses to DeVonta Smith and a 1-yard TD plunge. ”I really appreciate the staff. That’s not a one-week project; that’s been going on all year.”

The NFL-leading Eagles (13-2) need one victory in their final two games to wrap up home-field advantage throughout the NFC playoffs. A win would also secure the NFC East title.

The defending division champ Cowboys (11-4) kept alive their faint hopes of catching Philadelphia.

Even though the Eagles knew they likely would be without Hurts – who sprained his throwing shoulder in last week’s win over Chicago – they gave Minshew the day off Tuesday to attend the service at Mississippi State.

Minshew said he was back with the team that night. On Saturday, his defense gave him an early 10-0 lead thanks to Josh Sweat’s pick-6 of Dak Prescott. Minshew had the Eagles in position for the victory after a 14-yard touchdown pass to Smith for a 27-17 lead in the third quarter.

The Cowboys pulled even at 34-34 on CeeDee Lamb’s second TD grab.

Near midfield on the next possession, Minshew threw to Quez Watkins on a quick slant, and the receiver had the ball in his hands before rookie cornerback DaRon Bland took it away as both players rolled over on the tackle.

The Cowboys drove for the go-ahead points. Dallas had to settle for another field goal from Brett Maher – his fourth – after Miles Sanders’ fumble as the Eagles had two of their four turnovers in the final five minutes.

”You can’t give a good team like that the ball four times,” coach Nick Sirianni said. ”We put the defense in a tough spot. We can’t help a good team beat us by giving the ball away.”

Needing a touchdown to win, Minshew got the Eagles to the Dallas 19-yard line with a 22-yard completion to Smith, who had 113 yards receiving.

After spiking the ball to stop the clock, Minshew threw incomplete twice. He was never sacked against the league’s No. 2 defense in sacks, but faced heavy pressure on the decisive play and had to chuck the ball deep.

That final incompletion ended Philadelphia’s run of scoring on 36 consecutive possessions inside the 20. It was the longest active streak in the NFL.

Minshew threw his first interception in the first half, when safety Jayron Kearse reached over a receiver to grab the ball.

”I thought Gardner played a really good game,” coach Nick Sirianni said. ”The first interception was by (Kearse), he’s a real good player. The second one, the ball was in both their hands and their guy came away with it.”

Philadelphia’s lead over Minnesota for the NFC’s top seed is down to one game, which could provide more urgency for the Eagles to get Hurts back on the field on New Year’s Day against New Orleans.

”We’ll see what happens with Jalen,” Sirianni said. ”We thought he had a chance to play this week. He’s our starting quarterback. If he’s ready to go, then he’ll go. That’s nothing against Gardner.”

AP NFL: https://apnews.com/hub/nfl and https://twitter.com/AP-NFL