They were hopelessly behind. Thirty-one back with less than two months to play. Many of the keys to making a charge were injured, so no way could the Yankees catch up.

But they did.

Through the games of Aug. 3, the Twins had 216 homers, the most in the majors. Next were the Dodgers at 187, the Astros at 186 and the Yankees at 185. There were 52 games left. Gary Sanchez, who at that point led the Yankees in homers, was on the injured list, as was Luke Voit, who was third on the team.

The Yankees played a doubleheader on Aug. 3. Edwin Encarnacion fractured his right wrist in the opener and was lost for a month. Aaron Hicks blew out his arm in the nightcap and was lost for the season.

Hicks was one of four Yankees to deliver 27 homers last year — second on the team that set the major league homer record with 267. The other three were Miguel Andujar, who played 12 games this year, and Didi Gregorius and Aaron Judge, who both missed two months. Giancarlo Stanton led the 2018 Yankees with 38 homers. He played nine games this season before Sept. 18.

In 2018, those top five combined to hit 146 homers — 90 more than they have hit so far this year.

Yet the story of the 2019 Yankees — like many stories in this longball-doused season — can be told through homers. The next men up kept hitting them. Brett Gardner and DJ LeMahieu hit them like never before. And Gleyber Torres hit way more than was anticipated, specifically this early in his career. Yankees depth brought length, testing the resolve of opposing pitchers and John Sterling’s wordplay.

By Sept. 10, the Yankees had caught the Twins at 276 homers. The Yankees now lead 298-297, though the Twins have one extra game. The Yankees would probably like to be the first team to 300 and also to retain their single-season long-ball crown.

But there is this: Since the 1969 expansion, which ushered in multiple rounds of playoffs, only four teams that led the majors in homers have won the World Series and just one has done so since 1985: the Yankees’ last champion in 2009.

So that fits the narrative loathed by Aaron Boone and sabermetricians everywhere: that, come October, dependence on homers is bad.

Except you better hit homers in the postseason. There have been 168 best-of-five or best-of-seven series in the wild card era (since 1995). The team that hits more homers advances disproportionately, going 104-48 (the clubs ended with the same number of homers 16 times). So if a team wants to advance, it better figure out how to hit more homers, give up fewer or — preferably — both.

If the season ended today, the Yankees would play the Twins in the Division Series. Their most likely foes should they keep advancing would be the Astros in the ALCS and the Dodgers in the World Series. Those are the teams ranked 1-2-3-4 in homers this season — each having cleared the 267 of last year’s Yankees. Those were the teams with the four best records in the majors.

In the final week of the regular season, the Yankees are hoping to have Encarnacion and Sanchez follow Stanton back to the lineup and become available for the playoffs. Thus, even without Hicks and Mike Tauchman and Andujar (if you remember what he looks like), the Yankees will not lack for might.

The questions from Oct. 4 forward will be: Does the power carry over and can the Yankees do a far better job of unplugging their opponents’ power? The Yankees and Phillies are the only teams with winning records that rank in the bottom third of MLB in homers allowed per nine innings. The Dodgers rank third, the Twins are fifth and the Astros are No. 18. Twelve of the top 13 teams in fewest homers per nine innings have winning records. That includes the Rays, A’s and Indians, one of whom would be the Yankees’ Division Series opponent rather than the Twins if the Yankees leap the Astros for the AL’s best record.

Such homer-prone hurlers as Nestor Cortes Jr. and Domingo German will not be part of the Yankees postseason staff, but J.A. Happ and CC Sabathia will be — albeit in probably more compartmentalized roles.

Before then, the Yankees will try to outdo the Twins for the homer crown. There is no magic number, not 300 or 305. Who knows how high this will go? Heck, the Yankees were off Monday and still probably hit two more homers, especially if Orioles pitching was in the vicinity. It’s been that kind of season. Long roster. Long balls. And still a long way to go to know what it all means.