It was getting dangerously late, and the Detroit Tigers had little time to spare, jumping into their car Thursday evening and speeding to Justin Verlander’s house.

They had to talk.

And in a hurry.

The Detroit Tigers, after talking with the Houston Astros for nearly two months, finally got the deal they wanted around 11 p.m.

Yet, there was less than an hour before the midnight ET trade deadline, and they still needed Verlander to sign off on the deal.

Verlander, 34, who has been with the Tigers for 13 years of his life, knew the Tigers badly wanted to trade him, and to be honest, knew it was time to leave. The Tigers had gone into a full-scale rebuild, dumping All-Star outfielder Justin Upton earlier in the day to the Los Angeles Angels, and they needed to shed not only the remainder of Verlander’s $56 million salary, but obtain prized prospects, too.

Blockbuster:Trades by Astros, Angels alter AL playoff chase

Stunner:Verlander to Astros in last-minute deal

Trade:Angels gear up with Upton, Tigers downshift

Verlander, who had full no-trade protection having spent at least 10 years in the big leagues and five with the same team, told the Tigers all along that if he was traded, his first choice was to the Los Angeles Dodgers. He and his fiancée Kate Upton have a home in Beverly Hills, and the Dodgers not only are built to win now with baseball’s best record, but for the long haul. The Dodgers, who landed Yu Darvish from the Texas Rangers in July, weren’t interested.

His second choice was the Chicago Cubs. The Cubs wanted him, and were willing to assume most of Verlander's remaining contract, but simply didn’t have the prospects to also include in a deal.

They were out.

Verlander was informed by the Tigers it would be the Astros or nobody.

So, after getting permission from the Tigers, he started making calls. The Astros called him. He had questions. Lots of them.

He talked with Astros ace Dallas Keuchel. He talked with Astros owner Jim Crane. He talked with Astros manager A.J. Hinch.

“He was a little worried about Houston (in the aftermath of Hurricane Harvey),’’ Crane told USA TODAY Sports. “I told him, 'This town is going to be fine. It’s going to take time. You will be received great here. We’ve got a good team, a good manager, a good front office. There won’t be any problems here.

“The big thing to him was that he had never been traded. He didn’t know a lot about the city. I told him, 'We’ve got a lot of good players for a few more years. This is a great spot of reaching your goal of winning the World Series. You got to take a shot.’

“He had to make up his mind in a hurry because there wasn’t much time.’’

There was so little time that once the three Astros prospects cleared physicals - pitcher Franklin Perez, outfielder Daz Cameron and catcher Jake Rogers - Tigers GM Al Avila was waiting at Verlander’s home with the trade papers for him to sign.

Verlander, once the Astros agreed to provide full no-trade rights while also voiding the 2020 option year in his contract, agreed with about two minutes before midnight.

“It was close,’’ Crane said. “He decided to come over at the last second.’’

Said Astros GM Jeff Luhnow: “Nothing forces a deal like a deadline.’’

The blockbuster was complete. The Tigers were sending Verlander, along with a player to be named later, to the Astros while also paying $8 million of his salary in 2018 and 2019. The Astros received the Astros’ No. 3, No. 9 and No. 11 prospects, and saved themselves $38 million.

The two teams were ecstatic, celebrating late into the evening, and a city that has been devastated by one of the worst natural disasters in American history, received a jolt of energy.

“I think it will bring hope,’’ Hinch said Friday, “something to look forward to while we rebuild the city, and rebuild parts of the city that some of us can’t fathom that’s been destroyed. We are a baseball team. We will keep it in proper perspective, and provide entertainment for a lot of people in our community.

“I think this team will work really hard to make this city proud, make this city feel good when there are a lot of people going through tough times.’’

The Astros’ impact on the community was important enough for Houston Mayor Sylvester Turner to request the Astros to return to Houston this weekend instead of playing their three-game series against the New York Mets in Tampa.

The Astros, who had 20 employees lose their homes during the flooding, will provide free tickets for about 5,000 Houston natives. They will honor first responders. Turner will throw out the first pitch.

“It’s going to be great just to get people’s minds off devastation,’’ said Crane, “uplifting for the city, and help take their mind off this. It’s bad. We’ll raise money and turn a big negative into some relief for the community.’’

Oh, and yes, and they’ll be unveiling Verlander for all of Houston to see.

“We all want to keep everything in perspective,’’ Luhnow said. “There were a lot of people that suffered tremendous loss over the course of last week, and our city will be suffering the consequences of this storm for a long time to come.

“We, the Astros organization, are doing everything we can to help those people in need. And part of our responsibility is to provide a distraction, entertainment, hope, aspirations for the future, all of those things that people turn to sports for.

“We recognize our part in this, and hopefully have a successful September and a long postseason run, that will give people in Houston a healthy distraction.’’

The Astros, who tried to acquire Verlander in July before the non-waiver deadline, and engaged in trade talks with the Tigers virtually every other day this month, finally got the man they wanted all along, giving them a chance to win their first World Series in franchise history.

“There were several times throughout the month that I thought the trade was going to happen,’’ Luhnow said, “and several times throughout the month where I thought the deal was completely dead.

“I was confident we were going to get the deal over the finish line, but I had my doubts the last 20 minutes.’’

Verlander reminded the Astros late Thursday that he’s just as hungry as they are to make it happen. He has an MVP and Cy Young plaques in his trophy case, two no-hitters and two American League pennants, but not a World Series ring.

“He was so excited and he felt really good to join this type of contender,’’ Hinch said. “He’s been so successful in his career. The one thing missing was a World Series ring. He let it be known to me he wants to win, and he wants to win here. He respects the success we’ve had, and wants to do his part.

“We need to do everything we can to bring a winner to Houston.’’

They certainly took a giant leap Thursday evening, with seconds to spare.

Follow Nightengale on Twitter and Facebook

Gallery: Players traded after the July 31 deadline