WASHINGTON — Texas Sen. Ted Cruz ended his presidential campaign Tuesday, eliminating the biggest impediment to Donald Trump’s march to the Republican nomination.

The conservative tea party firebrand who cast himself as the only viable alternative to Trump announced his exit after a stinging defeat in Indiana’s Republican primary.

“It appears that path has been foreclosed,” Cruz told supporters in Indianapolis. “Together, we left it all on the field of Indiana. We gave it everything we’ve got, but the voters chose another path, and so with a heavy heart but with boundless optimism for the long-term future of our nation, we are suspending our campaign.”

Cruz had already been mathematically eliminated from clinching the delegate majority in the state-by-state primary process, but hoped to force a contested national convention in July. That possibility ends Tuesday with the Texas senator’s announcement.

Had he succeeded in his quest, Cruz would have been the first U.S. president of Hispanic descent, although he often downplayed his heritage on the campaign trail, instead, touting the need for tougher immigration laws, for a border wall along the border with Mexico, protecting gun rights, repealing President Barack Obama’s health care law and instituting a flat tax.

Cruz argued he was the only true conservative in the race, building on his reputation in the Senate where he clashed both with Democrats and members of his own party over his ideological stubbornness. Cruz railed against what he called the “Washington cartel,” trying to appeal to an electorate that is craving political outsiders.

But he ultimately couldn’t compete with Trump’s appeal among white, working class voters who were drawn to the billionaire’s outlandish approach to politics.

Cruz’s campaign placed its hopes on a data-driven effort to turn out conservative evangelical Christians who had opted out of recent presidential elections. Increasingly, he would modify his travel schedule to go where data showed there might be pockets of untapped supporters.

With the scale tipping increasingly in Trump’s favor, he announced an extraordinary pact in April with his other rival, Ohio Gov. John Kasich, in which the two would divide their time and resources based on states where they were each poised to do better.

Days later, he prematurely named former Hewlett-Packard chief executive Carly Fiorina as his running mate, hoping it would woo some of the female voters turned off by Trump’s brash rhetoric.

Trump’s appeal to evangelicals, though, and the New York billionaire’s popularity with the broader Republican electorate, proved too much.

Cruz, 45, worked on George W. Bush’s 2000 campaign and went on to serve five years as the top attorney for the state of Texas, arguing nine cases before the U.S. Supreme Court. He parleyed that experience into an underdog run for the U.S. Senate, defeating the state’s lieutenant governor in the primary before winning election in 2012.

He first burst on the national political landscape in 2013 when he led a 21-hour quasi-filibuster against President Barack Obama’s health care law, reading his children Dr. Seuss’s “Green Eggs and Ham” as a bedtime story via CSPAN during the marathon effort.

Cruz later teamed with the most-conservative members of the House to spark a government shutdown. It ultimately didn’t accomplish any major Republican goals, but raised Cruz’s national profile even more.

Cruz built a coalition of like-minded Republicans in Congress, as well as former presidential rivals — Fiorina, Wisconsin Gov. Scott Walker, ex-Texas Gov. Rick Perry and Sen. Lindsey Graham among them — but won only minimal support from his Senate colleagues.

Cruz’s campaign slogan of “Trusted” was tarnished after he was forced to apologize to Ben Carson for falsely suggesting the night of the Iowa caucuses that the retired neurosurgeon was dropping out of the race. Cruz also abruptly fired his communications director a day before the Nevada caucuses for spreading a false story about Florida Sen. Marco Rubio disparaging the Bible.

Trump nicknamed Cruz “Lyin’ Ted,” and derided him as “unstable,” ”crazy,” ”a maniac” and “sick.”

Trump also questioned whether Cruz’s birth in Canada disqualified him to run for president, frequently threatening to sue him over the issue. He never followed through, but several suits were filed, including in Cruz’s home state of Texas.

Cruz initially avoided attacking Trump, hoping that the former reality TV star’s supporters would flow to him if Trump flamed out. As Trump’s momentum grew with early primary victories, Cruz fought back and said Trump can’t be trusted because of his past support for Democrats, abortion rights and same-sex marriage.

But it was too late.

Cruz was joined on stage with his parents, as well as by Fiorina and his wife, Heidi.

He made no mention of the Republican front-runner, vowing instead to continue his fight for liberty and for the Constitution.

Associated Press reporters Steve Peoples and Scott Bauer wrote this report. Peoples reported from Washington. Associated Press writer Will Weissert in Austin, Texas, contributed to this report.