MIAMI — In Wednesday night’s first Democratic presidential debate, two candidates who happen to come from the same state gave a vivid demonstration of what to do — and what not to — when the pressure is on.

Though the stage was crowded, one of them showed how a well-prepared underdog can seize an opportunity to elevate his stature and define his rationale for running. The other did pretty much the opposite, trying to coast on platitudes more suitable for stump speeches and reinforcing growing doubts as to whether he is truly ready for the endeavor he has undertaken.

Former Housing and Urban Development secretary Julián Castro, barely registering in the polls, badly needed this breakout moment. Castro, who also served five years as mayor of San Antonio, created it by arriving ready to press his case on immigration, where he has put forward the most far-reaching plan of any candidate to overhaul the nation’s laws.

It was a good time to do it: The nation’s conscience has been seized by headlines about the deplorable conditions under which helpless children are being held in federal detention centers, and by the horrifying image of a Salvadoran migrant father and his toddler daughter lying drowned in muddy water.

Meanwhile, Castro’s fellow Texan Beto O’Rourke had the roughest go of any of the candidates on the stage.

O’Rourke’s charisma and uplifting message made him a star in last year’s midterm elections. The former congressman turned out legions of Democratic voters in Texas and came within almost three points of beating Sen. Ted Cruz (R-Tex.) in a state that has not elected any Democrat to statewide office since 1994.

But a presidential campaign demands a different set of muscles, a sharper game. That is particularly true in high-pressure moments such as debates, when millions of Americans are paying attention. O’Rourke revealed Wednesday that he has yet to develop the capacity to shift gears.

He began by whiffing a straightforward opening question from NBC moderator Savannah Guthrie on marginal tax rates. O’Rourke delivered a canned answer — delivered in both Spanish and English — that rambled through campaign finance reform, gerrymandering, same-day voter registration and “power to the people.”

From there, it got only worse for O’Rourke. He was caught off balance as Castro ambushed him over and over on O’Rourke’s refusal to support Castro’s own call for a repeal of a law criminalizing illegal border crossings. O’Rourke has put forward a more limited plan, which would extend more protection to asylum seekers.

“I’m talking about everybody else,” Castro interjected. “I am talking about millions of folks, a lot of folks that are coming are not seeking asylum. A lot of them are undocumented immigrants, right?” Castro’s stance will no doubt be described as “open borders” by President Trump and other Republicans. But the best evidence that he had hit his mark was the fact that other Democratic contenders were soon emphasizing how much they agreed with him.

Nor did Castro let up on O’Rourke when the debate was over.

The former congressman, Castro said, “needs to do his homework.” He added: “I find it very ironic that a senator from Massachusetts [Elizabeth Warren] and a senator from New Jersey [Cory Booker] are the ones who understand this border policy and this law better than Congressman O’Rourke.”

Castro had laid his debate strategy carefully. “What we discussed was him picking his moments on things that he is passionate about,” his twin brother Joaquin, a Democratic congressman who represents the San Antonio area, told me after the event was over. “There’s a certain instinct to it.”

There was also a certain bluntness. The deaths of migrant Óscar Alberto Martínez Ramírez and his daughter Valeria were “heartbreaking. It should also piss us all off,” Julián Castro said during the debate.

Again and again, he muscled his way in, interrupting the other candidates, and as he did, Google searches of his name surged more than 2,400 percent. As he made his way through the “spin room” afterward, Castro was trailed by a mob of journalists, the kind of treatment usually afforded a top-tier contender.

With his scrappy, skillful performance on Wednesday, Castro showed he belonged on that stage, while O’Rourke sowed new doubts as to whether he did. There are many debates still to come, of course. Castro will not have the element of surprise next time, and O’Rourke has no doubt gotten the message that he is in a new league.

The terms of engagement have been set — and not just for those two Texans. In a field as crowded with talented contenders as this one is, no one gets a pass.

Read more: