Ted Cruz announces he =former rival Carly Fiorina will be his running mate. Here are key moments from that event. (Video: Sarah Parnass/The Washington Post)

Ted Cruz, in an apparent act of desperation, announced Wednesday that Carly Fiorina will be his vice presidential running mate if he is the Republican nominee for president.

Announcing a running mate is an unusual step that comes as he trails GOP front-runner Donald Trump by a wide margin and faces an increasingly narrow path to the Republican nomination.

Cruz hopes to gain steam in what amounts to a must-win for him in Tuesday’s Indiana primary. A day before the announcement, Trump drubbed Cruz in five Eastern states and stretched his overall lead in delegates to the Republican convention to nearly 400.

Fiorina, a former Republican presidential candidate who endorsed Cruz in March, has been one of his most active surrogates. The former Hewlett-Packard chief executive has been an outspoken critic of both Trump and Democratic front-runner Hillary Clinton.

The Fix: This choice is a Hail Mary

Ted Cruz exits the presidential race

Republican presidential candidate, Sen. Ted Cruz, R-Texas, speaks with his wife, Heidi, by his side during a primary night campaign event, Tuesday, May 3, 2016, in Indianapolis. Cruz ended his presidential campaign, eliminating the biggest impediment to Donald Trump's march to the Republican nomination. (AP Photo/Darron Cummings)

“If I am nominated to be president of the United States, I will run on a ticket with my vice presidential nominee, Carly Fiorina,” Cruz said at a Wednesday afternoon rally.

Trump quickly responded to the news.

“After massive defeats in Arizona, New York, Pennsylvania, Rhode Island, Delaware, Connecticut and Maryland, (in addition to twenty other contests) and given the fact that Senator Cruz has millions of votes less than me and is being clobbered on the delegate front, this is a pure waste of time,” Trump said in a statement. “It reminds me very much of the already failed Kasich ‘collusion’ — a desperate attempt to save a failing campaign by an all talk, no action politician. The people of Indiana are very smart — they will see through this just like they saw through the already failed Kasich alliance. Cruz has no path to victory — he is only trying to stay relevant.”

Cruz has won endorsements from five of the defeated 2016 candidates, including his former governor, Rick Perry.

Just weeks after endorsing Cruz, Fiorina joined the candidate’s wife, Heidi, on a busy retail tour of Wisconsin, drawing glowing press coverage. Days later, she traveled to Fargo, N.D., to help him win the state’s GOP convention, a job that required days of hands-on campaigning.

It was a preview of the sort of work she might be expected to do as a running mate. Fiorina spent hours working the cash-bar hospitality suites where the activists who would elect delegates were being courted. Hundreds of them walked away with selfies; all of them heard her endorse Cruz again from the convention stage. That helped Cruz to a better-than-expected haul of 18 supporters on the state delegate slate.

Trump and Cruz are currently focused on Indiana, where the mogul is seeking a knockout blow and Cruz is making a last-gasp effort to survive.

Moments when Ted Cruz was more surprising than Donald Trump

LEFT: SOCTIA, NY - APRIL 7: Republican presidential candidate Ted Cruz loosens his tie which speaking to supporters after a townhall at Mekeel Christian Academy in Scotia, New York on Thursday, April 7, 2016. Cruz begins campaigning in New York state after his decisive win in Wisconsin on Tuesday. (Photo by Cassi Alexandra/For The Washington Post) ------ RIGHT: POUGHKEEPSIE, NY - APRIL 17: Republican presidential candidates Donald Trump speaks during a campaign event at the Mid-Hudson Civic Center in Poughkeepsie, NY on Sunday April 17, 2016. (Photo by Jabin Botsford/The Washington Post) (Left: Cassi Alexandra/For The Washington Post, RIGHT: Jabin Botsford/The Washington Post)

Trump is returning to the Hoosier State for an evening rally after delivering a foreign-policy address in Washington on Wednesday morning that his team hoped would make him appear more presidential. He will be joined in Indiana by longtime Indiana University basketball coach Bob Knight, who is a fan favorite here.

Cruz, who has spent the past few days in Indiana trying to get a head start on Trump and move swiftly past his humiliating Tuesday defeats, teased his announcement at an Indianapolis restaurant Wednesday morning.

Looming over the race is the question of whether Gov. Mike Pence will publicly back Trump, Cruz or no one. The governor met with both candidates last week.

“He may not endorse — I don’t think he’ll endorse anybody, actually — and he may endorse us, I don’t know,” Trump said on CNN on Wednesday morning. He added that he thinks Pence will either endorse him or no one.

Indiana is the only state holding a Republican primary next Tuesday. Trump and Cruz are expected to spend much of their time campaigning here. A loss for Cruz would deal a catastrophic blow to his campaign, which was set back immensely by his poor showing Tuesday.

The third remaining candidate, Ohio Gov. John Kasich, has stopped actively campaigning in Indiana, clearing the way for Cruz to square off against Trump one on one. In exchange, Cruz is clearing the way for Kasich to face Trump in Oregon and New Mexico. Kasich plans to stump in Oregon on Thursday.

The Cruz-Kasich deal has been unsteady, and it's not clear whether it will have the intended effect of isolating and defeating Trump in three key states.

Polls show Trump and Cruz in close competition in Indiana. In a speech Tuesday night at the Hoosier Gym in Knightstown, where the movie "Hoosiers" was filmed, Cruz declared to supporters: "Tonight this campaign moves back to more favorable terrain."

Cruz will enter the next week badly wounded by two straight weeks of East Coast blowout losses in which he mostly finished third behind Trump and Kasich. On Tuesday, Trump swept Connecticut, Delaware, Maryland, Pennsylvania and Rhode Island. In all but Pennsylvania, Cruz finished last.

According to the Associated Press's latest delegate count, Trump has nearly a 400-delegate lead over Cruz and is nearly 800 ahead of Kasich.

Trump called his Tuesday sweep the “biggest night” of the campaign, confidently predicting that he could capture the 1,237 delegates needed to clinch the Republican nomination outright. He also suggested during a question-and-answer session with reporters at Trump Tower on Tuesday evening that Cruz and Kasich were doing the party harm by remaining in the contest.

“I consider myself the presumptive nominee, absolutely,” Trump said. He suggested that Cruz and Kasich exit the race because “they have no path to victory at all.”

He added: “The best way to beat the system is to have evenings like this, where you get record-setting votes.”

Responding Wednesday morning to reports that Cruz was vetting Republicans to be his vice presidential running mate, Trump said that it was not a good idea.

“I think it hurts him. I can’t imagine he does it,” the mogul said on “Fox and Friends.” “First of all he shouldn’t be naming anybody because he doesn’t even have a chance.”

Cruz nodded at the vice presidential intrigue surrounding him Tuesday night, saying he had an announcement. But the announcement — that Clinton had tapped Trump as her running mate — was made in jest.

During a rally in Indiana last week, Trump put the air-conditioning maker Carrier at the center of his pitch. He is expected to continue doing so. The company has announced that it plans to move jobs from Indianapolis to Mexico. Trump said that as president, he would subject such a move to a tax penalty. He has mentioned Carrier in other states, too.

Trump also has bragged about Knight’s endorsement on the campaign trail for days.

“He’s tough, he’s sharp and he wins. And the people of Indiana love him,” he said Tuesday.

Cruz repeatedly tried to link Trump to Clinton on Tuesday night, signaling that he plans to try to blur the distinction between them on several policy and political fronts during the next week.

Clinton and Trump are “flip sides of the same coin,” argued Cruz, who accused Trump of holding Clinton-like views on health care, foreign policy, immigration and other issues.

Trump has been an outspoken critic of Clinton. He has referred to her on the campaign trail as “Crooked Hillary.”

Indiana awards 57 delegates to the Republican National Convention on a winner-take-all basis by congressional district and statewide.

Costa reported from Washington. Jose A. DelReal in Indianapolis, Dave Weigel in Portland, Ore., and Katie Zezima in Washington contributed to this report.