Before he began his most extensive relief appearance in three seasons, Colt McCoy buckled his chin strap and ran out to midfield to check on Alex Smith.

The Washington Redskins’ starting quarterback was still on his back on the FedEx Field turf, still in pain after suffering a gruesome leg injury in the third quarter against the Houston Texans — McCoy’s cue that he would be needed for the rest of the afternoon.

McCoy find out later that he will be needed for the rest of the season after Smith was ruled out with multiple fractures in his right leg, but not before he nearly rallied the Redskins in a 23-21 loss Sunday.

This was a defeat full of mistakes and question marks, but McCoy at least showed glimpses of promise. He engineered a pair of scoring drives, which included impressive touch on a nine-yard touchdown pass to Jordan Reed, and he positioned the offense near midfield in the final seconds to at least give the Redskins a chance to win, but a 63-yard Dustin Hopkins field goal attempt fell short.

“You pray for opportunities to get to play,” said McCoy, who completed 6 of 12 passes for 54 yards. “You never like to see how it happened today.”

McCoy stayed on one knee as Hopkins’s field goal attempt fell short, but he had no reason to hang his head on a day that will be remembered for the severe injury Smith suffered. But as McCoy takes over the offense and Washington heads into a crucial division matchup at Dallas on Thursday, clinging to a one-game NFC East lead over the rival Cowboys, he received unwavering confidence from his teammates inside a sullen locker room.

That included from cornerback Josh Norman, who approached McCoy after the loss. McCoy, who has been a backup with Washington since 2014, told Norman, “You’re in good hands with me.”

“I can take that all day,” ­Norman said.

“We’re going to have to lean on him to get it done,” running back Adrian Peterson said.

“Colt’s always ready,” center Chase Roullier said.

McCoy surely was Sunday after Smith was carted off the field in the third quarter with the Texans leading 17-7. The first play-call McCoy received was a designed draw — for himself.

“I was like: ‘All right, where’s my mouthpiece at? Got a run play here,’ ” he recalled.

After a pickup of four yards to the Houston 9-yard line, McCoy threw his first pass since the 2015 season — a touchdown in the back of the end zone to Reed that cut it to 17-14. Early in the fourth quarter, fueled by completions to Josh Doctson and Trey Quinn, McCoy orchestrated a 10-play, 67-yard drive that culminated in a Peterson seven-yard touchdown that gave Washington a brief lead.

There were missed opportunities, too, including on the final drive, when Washington failed to move Hopkins closer after taking vertical shots to Michael Floyd and Doctson. McCoy didn’t dwell on those misses. Once considered a potential long-term answer at quarterback in Cleveland, he has bided his time for moments such as the one that arrived Sunday in Washington, where he takes over a team that remains at the top of its division and is in the thick of the postseason hunt.

“We have a good team here, and they’ve got us in great shape. Alex has got us in great shape,” McCoy said. “We’ve just got to go continue to play football.”

More Redskins coverage: