Thirteen months after launching his campaign for president on the promise of being the purest conservative in the contest before a large and exuberant crowd, Ted Cruz ended it abruptly Tuesday night in a cavernous room here in front of a small group of downtrodden supporters.

Acknowledging that he had no path forward against Donald Trump, the senator from Texas suspended his bid in the state he had hoped would keep him afloat until a contested Republican convention, where his strong relationships with party activists would help him claim the nomination.

Instead, his final speech was met with gasps and shouts of “No!” After weeks of telling backers he planned to become his party’s standard-bearer at the Cleveland convention, he explained that the razor-thin track he was pursuing to the nomination was gone.

“Tonight, I’m sorry to say, it appears that path has been foreclosed,” he said. “Together, we left it all on the field in Indiana.”

Cruz also said he would “continue to fight for liberty” but did not address whether he would support Trump as the nominee.

Republican presidential candidate Donald Trump held a campaign event at Trump Tower in Manhattan, after sweeping the Indiana primary. (Victoria Walker/The Washington Post)

It was a somber ending for a candidate who made a splash last year as the first major candidate to announce a presidential run and spent two weeks here in Indiana making a series of increasingly desperate high-profile moves to keep his candidacy afloat. They in­cluded naming former Hewlett-Packard chief executive Carly Fiorina as his running mate in a bizarre announcement where Cruz spoke for half an hour and Fiorina sang to his young daughters.

In his last day on the campaign trail, Cruz unloaded on Trump, calling the businessman a “pathological liar” and a “narcissist” who was proud of being a “serial philanderer.” The attacks were reminiscent of the broadsides that Sen. Marco Rubio of Florida launched against Trump in the waning days of his own presidential campaign — and a far cry from the lavish praise Cruz heaped on Trump for most of 2015. “I like Donald Trump,” he had declared.

Cruz’s campaign hit its zenith in February when he resoundingly won the Iowa caucuses, largely through months of cultivating grass-roots support in the state. But it soon became a roller-coaster ride of crushing losses in states where Cruz expected to do well, including South Carolina and Georgia, followed by resounding wins in his home state of Texas and in Wisconsin. Cruz’s campaign used its grasp of the delegate process to beat Trump at state conventions where delegates were chosen, but it was not enough to overcome the businessman’s tally and strength with the electorate.

That Cruz remained one of the last candidates standing in a once-crowded field would have been viewed as improbable when he entered the race 13 months earlier. Cruz is a first-term senator known for getting under the skin of his Senate colleagues and championing controversial tactics to block the implementation of the Affordable Care Act. He was painted as a long-shot underdog who was too religious and too conservative to advance past the early nominating contests.

But his campaign had a meticulous strategy it planned to roll out over the year that followed, and it started working soon after he announced.

“It is the time for truth. It is the time for liberty. It is the time to reclaim the Constitution of the United States,” Cruz said during his campaign kickoff in Lynchburg, Va., at Liberty University, which was founded by fundamentalist preacher Jerry Falwell.

Cruz was immediately buoyed by impressive fundraising and the national platform that comes with announcing first. Groups backing him raised $31 million during the first week of his candidacy, and the campaign raked in $4 million.

The Texan’s campaign employed a strategy of slowly introducing Cruz to a national audience while furiously working to shore up support with local activists and evangelical Christian leaders in the first four voting states and the South.

The campaign also talked about securing the support of delegates to the July convention almost as soon as it launched, envisioning Cruz in a head-to-head matchup with an establishment rival. The campaign sent emissaries to such far-flung places as Guam and the U.S. Virgin Islands to try to lock down delegate support over the summer.

It was a campaign that reflected its candidate: methodical, strategic and data-driven. Cruz’s campaign deployed a sophisticated data strategy that used psychographic information to appeal to the fears or hopes of potential voters.

Cruz touted his outsider status and contempt for what he called the “Washington cartel” of politicians and lobbyists in politics to get rich. He made the enmity of his Senate colleagues a point of pride, joking about needing a “food taster” in the Senate dining room.

Cruz labeled himself a “consistent conservative,” championing what he viewed as the principles of the Constitution — his campaign even handed out a pocket Constitution with Cruz’s photo on it.

He traveled the country giving stump speeches where he roamed the stage — he does not like speaking from behind a lectern — that often resembled a hybrid between a Sunday sermon and a TED talk. He made it clear that no other candidate would get to the right of him, particularly on the issue of immigration.

But then came Donald Trump.

Cruz made an early, conscious decision to buddy up to Trump, brushing aside the businessman’s caustic comments about Mexicans and praising his toughness on immigration.

The two met at Trump Tower in July, where Cruz invited Trump to tour the U.S.-Mexico border with him. Trump went, but Cruz could not because of Senate votes. Cruz and Trump both appeared at a rally against the Iranian nuclear deal on Capitol Hill in September.

As other candidates were punching at Trump during the fall and quickly seeing their poll numbers drop as the businessman swatted back with insults, Cruz lavished praise on his rival.

Cruz also tacked sharply to the right to compete with Trump’s rhetoric. Cruz’s immigration proposals grew tougher the longer Trump was in the race. He criticized Trump’s plan for mass deportation of illegal immigrants, then seemed to support it. Cruz spoke of being weary of foreign intervention but promised to “carpet-bomb” the Islamic State to see if “sand can glow in the dark” there. He introduced a bill to bar refugees from Syria and other groups.

In December — as Cruz’s poll numbers were up nationally and in Iowa — he was caught on tape at a closed-door fundraiser questioning whether Trump has the judgment to be president. Cruz moved to smooth over the fracas, but Trump pounced. A few weeks later, Trump questioned whether Cruz, who was born in Canada, is eligible to be president.

Cruz then went on an offensive blitz against the businessman, assailing him for supporting “partial birth” abortion and bankrolling Democratic candidates. It seemed to work, with Cruz beating Trump in the Iowa caucuses. But the momentum stopped in New Hampshire, where Trump won by big margins before marching to victories in South Carolina and Nevada.

Trump also upended Cruz’s plan to chalk up big wins in the South, an area the campaign saw as receptive to Cruz’s unyielding conservatism and his Christian faith. The campaign was hit with internal turmoil when Cruz fired his communications director, Rick Tyler, after Tyler posted on social media a video falsely purporting to show rival Rubio disparaging the Bible. Some of Cruz’s most prominent backers openly questioned his campaign strategy.

Despite his other losses in the South, Cruz notched a win in his home state, which offered him a bonanza of delegates and kept his candidacy alive. A win in Wisconsin in April infused much-needed momentum into the campaign.

Cruz’s team proved adept at mastering the arcane art of delegate allocation, regularly snatching delegate support from Trump at state conventions. But as the primary calendar moved to the Northeast — an area hostile to Cruz, who derided “New York values” on the campaign trail — Trump gained momentum while Cruz flagged.

Indiana, which Cruz’s team had identified — along with Nebraska and California — as a state in which it thought it could do well, never warmed to him. Cruz announced that he and Ohio Gov. John Kasich had an agreement in which Cruz would campaign in Indiana and Kasich would not, instead focusing on Oregon and New Mexico. But the alliance turned rocky just hours after it was announced when Kasich refused to tell his supporters to vote for Cruz. The Texas Republican later said that there was no alliance, to which Kasich’s chief strategist tweeted: “I can’t stand liars.”

Cruz lit into Trump across the state, criticizing the endorsement he received from boxer Mike Tyson, who served time in prison in Indiana on a rape conviction, and decrying Trump as an insecure bully. The Fiorina announcement, meant to revive Cruz’s candidacy in the state, gave it no discernible boost. The two barnstormed around the state, where Cruz faced less-than-enthusiastic crowds, and confronted a pro-Trump protester in Marion.

On Tuesday night, a man was selling discounted Cruz merchandise in the back of the room where Cruz delivered his remarks. T-shirts were only $5 and buttons just $1, he announced. Nearby, supporters consoled one another. “His name is still on the ballot,” one rationalized.

When he was done speaking, Cruz hugged his wife and father, who were part of a group of family and close friends who joined him on stage.

“Our movement will continue, and I give you my word that I will continue this fight with all of my strength and all of my ability,” Cruz said.

Zezima reported from Washington.