On Oct. 22, 2017, Dan Bailey’s career as the most accurate placekicker in NFL history began shifting from what he called “the perfect storm” of rare job security with one team to opening the 2018 season as a free agent shagging his own footballs at a high school just outside of Dallas.

“We were playing the 49ers in San Francisco,” the former Cowboy and current Viking said this week during a break in preparing to face the Bears at Soldier Field in a Sunday night battle for first place in the NFC North.

“I started the game, hit two PATs, a couple of kickoffs. Felt fine. We were driving toward the end of the first half, so I was just hitting a couple kicks into the net on the sideline. I kind of felt something and was like, ‘OK, that’s weird.’ ”

A groin injury.

The first injury of a kicking career that began in middle school in Mustang, Okla., when coach Bobby Burke talked the young soccer player into being his kickoff specialist and, later, a three-way player for Southwest Covenant High School’s eight-man football team.

The injury would lead to his demise in Dallas. Bring a mulligan in Minnesota. And spawn Purple fantasies of finally stabilizing a kicking situation that has been tenuous at best since Blair Walsh’s infamous 27-yard duck hook ended a 10-9 wild-card playoff loss to Seattle in January 2016.

But, at the time, Bailey thought he’d just kick one more into the net and all would be fine.

“I hit one more and knew,” he said. “I went to our trainer and said, ‘Hey, something’s not right.’ ”

The Cowboys shut him down. Safety Jeff Heath finished up the kicking duties, going 2-for-3 on PATs in a 40-10 win.

Bailey was sidelined for four weeks. At the time, he had made 178 of 198 field goal attempts, best in league history at 89.9 percent. On the season, he was 7-for-7 on field goals and 14-for-14 on PATs.

Life of an NFL kicker

Healthy but out of sync from four weeks off, Bailey made only eight of 13 field goals and 10 of 12 PATs in his final six games in Dallas. He fell to No. 2 in career accuracy. Nine months later, on Sept. 1, the Cowboys cut the most accurate and productive kicker in franchise history — at age 30 — in favor of CFL journeyman Brett Maher, who had never kicked in an NFL regular-season game.

Welcome to the life of an NFL kicker.

“We had practice that morning,” Bailey said. “Cuts were that afternoon. I had no reason to believe it was even a possibility.”

Up to that point, the “perfect storm” of job security included winning a four-man competition as an undrafted rookie out of Oklahoma State in 2011; making six of six field goals in his third NFL game to score every point in an 18-16 win over Washington on “Monday Night Football”; and having the same snapper, L.P. Ladouceur, and holder, Chris Jones, for almost every game for all seven seasons in Dallas.

“It was cool getting to No. 1 in field goal accuracy,” Bailey said. “But working with the same two guys pretty much the whole time in Dallas had as much to do with that as anything I was doing.”

Today, Bailey’s career field goal percentage (. 871) ranks fourth. In seven games as a Viking, he’s made only 80 percent of his field goals (12 of 15) but 94.1 percent of his PATs (16 of 17).

His field goal percentage is lower than the .887 (45 of 53) that his predecessor, Kai Forbath, posted in 23 regular-season games as a Viking. But Forbath’s downfall and ultimate defeat at the feet of rookie Daniel Carlson was his .849 percentage on PATs (45 of 53).

Pressure-filled job

“I’ve never been a kicker at any level,” said All-Pro safety Harrison Smith, “but it seems really hard. If I mess up a play or two it’s not normally a big deal. Miss two kicks and it’s a big deal.”

Special teams coordinator Mike Priefer calls Bailey “such a veteran” and “a pro” while explaining why he’s not concerned about four misses in seven games, three of which Priefer says Bailey struck well and none of which were all Bailey’s fault. Priefer also believes Bailey will get better the more he works with long snapper Kevin McDermott and Matt Wile, who’s a first-year holder.

Then there’s coach Mike Zimmer, a man who admits to being snakebit by kickers. On Thursday, Zimmer was asked if Bailey has missed just enough kicks to keep him nervous.

Bailey had just made 16 of 16 field goals in Thursday’s practice. A day earlier, he made 15 of 16 with the wind pushing one ball into the left upright.

“I really don’t worry about him,” Zimmer said. “Guys are going to miss some. He’s been kicking the ball really good. I feel good about him.”

Ironically, Zimmer’s two wins in Chicago were three-point victories delivered by Walsh and Forbath in the closing seconds. Walsh kicked a 36-yard game-winner as time expired in 2015. Last year, Forbath won it with a 26-yarder with 12 seconds left.

Bears have own issues

Soldier Field isn’t the easiest place to kick. The Bears were reminded of that last Sunday when Cody Parkey bounced two field goals and two PATs off the uprights in a win over the Lions.

“What are the odds of that?” asked Bailey, who has played twice at Soldier Field and made both field goal attempts and all nine PATs.

“I couldn’t do it again if I tried,” Parkey told reporters in Chicago.

After the fourth miss, rookie coach Matt Nagy went for a two-point conversion and admitted that the misses affected his play-calling.

Then the young coach backed the young journeyman kicker by resisting the urge to try out kickers this week.

“I’m a guy, a person who just believes in, I guess you could say, second chances,” Nagy said.

Nagy then did something the Bears, oddly enough, haven’t done in years: send their kicker to Soldier Field to practice during the week. When the media found out that Parkey would be there Wednesday night, TV stations sent their helicopters to film the workout while hovering over Soldier Field.

Just another sign that Sunday’s game is a big deal for a team that hasn’t had a playoff game since Jan. 23, 2011.

Have footballs, will travel

Bailey was out of work from Sept. 1-17. Sixteen days and two games were all it took for multiple teams to call, for the Jets to work him out and for the Vikings to abandon Carlson after three ugly misses in a 29-29 tie at Green Bay.

“I’m pretty laid-back, so I wasn’t too upset,” Bailey said. “I’m not like antisocial or anything. But I do like to lay pretty low. I think you have to as a kicker because you can’t get on that roller coaster or it’s bad news.”

Three times during the week, Bailey would sling a bag of eight to 10 footballs over his shoulder, head for the nearest high school and kick 30 to 40 balls. Then, on the first two Sundays of the season, he went back and tried to simulate a game.

Out on the field. All alone.

At the time, he was the second-most accurate kicker in NFL history. Looking for a job while drawing strange looks.

“A couple guys in their mid-40s would be out there kicking the soccer ball around with their kids,” Bailey said. “They’d look over and you could tell they recognized me.”

And now, the former Cowboy via Mustang, Okla., just spent a wintry mid-November week in Eagan, Minn.

“If I’m being completely honest, no, I never would have thought that there’d even be a possibility that I’d be here,” Bailey said. “But I understand now that it’s very rare that anybody goes out on their own terms.

“Even Peyton Manning got cut in Indy. So you can’t sit there and feel sorry for yourself. You just move on and keep kicking.”