The first piece in the Washington Football Team’s quarterback puzzle fell into place Wednesday morning when Taylor Heinicke signed a two-year contract.

Heinicke, who was set to become a restricted free agent in March, said he wanted to stay with Washington because a two-year deal gives him security and he feels comfortable with Coach Ron Rivera and offensive coordinator Scott Turner.

“I’ve never felt I had two feet in the door [in the NFL],” said Heinicke, 27. “I’ve always felt that I’ve been fighting, either trying to make practice squad or even make the 53[-man roster]. It’s always been kind of one foot in, one foot out. Now I actually feel like there’s a little more security there. This is the first time I’ve felt that being in the league, so it’s a great feeling."

The contract includes a $1 million signing bonus and base salaries of $1 million and $1.5 million in 2021 and 2022, according to people with knowledge of the situation. With additional roster bonuses and incentives based on play-time percentage and team wins, Heinicke could earn up to $8.75 million over the length of the deal.

For Washington, Heinicke is the first step in solving the team’s biggest roster issue: quarterback stability. Last season, between injuries and poor performance, Washington shuffled its depth chart at least four times. Now the team has Heinicke and probably will re-sign Kyle Allen, an exclusive rights free agent, sometime before March 17. The future of veteran Alex Smith is unclear.

While team brass has praised Heinicke, it would prefer not to rely on just him and Allen at quarterback this season. During a video news conference last week with Rivera, General Manager Martin Mayhew and executive vice president of football/player personnel Marty Hurney, all three stressed the need to explore all options at quarterback. That includes a trade, the draft and free agency.

Heinicke said he was given no guarantees for his role next season. Rivera has preached competition since he started last season, and Heinicke added “that’s the best way to do it.” But the quarterback knows he must alter his style. He has gotten hurt in each of his two career starts playing at a busted-throttle pace because he didn’t know whether he would get another chance. Most recently, he separated the AC joint in his left shoulder on a dive for the pylon for a rushing touchdown in the first-round playoff game against the Tampa Bay Buccaneers.

“Say I was starting in Week 2 — I’m not diving for that pylon,” he said. “I’m going for that first down, getting out, and I’ve got four more downs to get a touchdown. Little things like that. But my style of play with extending with my feet and stuff like that, I think that’s part of my game, so I don’t see myself changing that in any way.”

If Heinicke were to win the starting job, it would be another remarkable chapter in his storybook journey. His career seemed finished as little as three months ago when he was studying for a mathematics degree at Old Dominion when Washington asked him to be the team’s “quarantine quarterback.” His stunning performance in the playoff loss to the eventual Super Bowl champion Buccaneers impressed many and earned him as much stability as he has ever had in the league.

The next big quarterback question for Washington probably involves Smith. If the team tenders Allen by March 17, his one-year salary would be $850,000. But Smith is owed a non-guaranteed salary of $18.75 million this year, and if he were to play, he would count $24.4 million against the cap. If Smith retires or is cut before June 1, the team would absorb $12.9 million in dead money; if either took place after June 1, the dead money would be $8.6 million. It’s possible the two sides could restructure Smith’s deal.

As for Heinicke, he said his left shoulder is “pretty much 100 percent.” This offseason, he wants to add weight to become more durable and refine his consistency. He recently passed both of the final exams his ODU professors let him postpone when he signed with Washington, and he has two 400-level math classes left to earn his degree. He said he hopes to finish those next spring.

After Heinicke signed his new contract, which he called “a little bit stressful,” he called his mother and sister. He had stayed with them for the past year and a half after fading from the NFL and bouncing from the XFL to college.

“They were kind of dealing with all my stuff,” he said. “I was not very fun to be around when I wasn’t in the league. Those two have done so much for me. They kept my head straight. Very exciting to share this moment with them.”

On Wednesday, after the news conference, Heinicke planned to fly back to Atlanta to celebrate his new contract with his mother and stepfather. He added, sounding like the endorsement-laden starting quarterback he could become: “We’ll probably go out and get a couple beers or so, a couple Heinekens.”

Nicki Jhabvala contributed.