Heidi loved her job running the Treasury Department’s Latin American desk. She had learned Spanish during late-night cram sessions and wanted a career in international affairs. Cruz encouraged her to stay in Washington instead of following him to Texas.

They had reason, he said, to think they could make a long-distance marriage work. Long distance meant phone calls, and they had fallen in love over long phone calls. Sure, they had met on the campaign, but Heidi had returned to Boston only weeks later at the end of her break. Before leaving, she had told Ted to call her every night.

“But I’m getting home at 2 and 3 in the morning,” he recalled telling her back then.

“I don’t care,” Heidi said. “Call me at 2 or 3.”

So Cruz called every night and woke her up, and they talked sometimes for as long as an hour, and occasionally Cruz would wake up with the phone by his ear and the call still running. They kept that up for months, and within a year they were married.

Talking, Cruz said, “was how the relationship was built.”

When they discussed the solicitor general’s job, Heidi said it fit his strengths. He should go for it. And so he did. He called Bayless, who had a friend in the attorney general’s office, and asked him to put in a good word. Cruz knew he was a long shot, given his dearth of experience arguing cases. And in Texas, the position was particularly high-profile. Attorney General Greg Abbott, who is now Texas’s governor, wanted the state to be assertive about taking conservative issues to the Supreme Court.

Cruz interviewed for the job on a Saturday and came prepared. He laid out a vision for the position that was even more aggressive than what Abbott had envisioned, said Barry McBee, the deputy attorney general at the time. Cruz suggested that Texas partner with other states and form coalitions to go before the Supreme Court, a way of broadening the state’s platform.

“I saw clearly incredible — not raw, but developing — talent,” McBee said.

Abbott offered Cruz the job while he and Heidi were in California, staying with her parents for Christmas in 2002. The call came early, 6 a.m. on the West Coast, when both were still in bed. Cruz accepted on the spot.

“I was blown away,” Cruz said, “and Heidi was, too. We were both like, ‘Wow.’ ”

Only years later, Cruz said, did Heidi admit why she had been so encouraging about applying for the job: She’d doubted Cruz would be chosen.