PASADENA, Calif. — A few weeks ago, Juan Carlos Osorio, the coach of Mexico’s national soccer team, sat in the sunny courtyard of a Beverly Hills hotel, nursing a cup of coffee and reliving the moment in 2016 that very nearly derailed his 20-year journey from a small club on Staten Island to his first World Cup.

Osorio, 57, had just presided over the most humiliating defeat in Mexico’s history, a 7-0 demolition by Chile in the quarterfinals of the Copa América, the world’s oldest international tournament. It was the sort of loss that gets a coach fired, especially in Mexico — provided Osorio didn’t quit first.

[Up Next: Follow our live coverage of Mexico vs. Brazil]

“I went into the locker room, splashed cold water on my face, loosened my tie and told my team, ‘If there is no trust in our work then I will go out there right now and tell everyone I resign,’” he recalled.

Osorio’s players stood behind him, and, to the surprise and dismay of the Mexican fans and news media, so did the country’s soccer federation. Twelve full-time and interim coaches in 12 years were apparently enough, at least for the moment.