MEXICO CITY — A popular candidate for governor who had made increased security his prime campaign pledge was killed along with at least four others Monday morning in a brazen attack, rattling a nation already alarmed by surging drug violence.

Despite years of atrocities tied to drug gangs, the killing of a candidate who was widely considered the front-runner just days before voters go to the polls drew unusually wide condemnation, and it drove election-related violence to a level not seen in Mexico in years.

“This was an act not only against a candidate of a political party but against democratic institutions, and it requires a united and firm response from all those who work for democracy,” a stern-faced President Felipe Calderón, who has found his presidency repeatedly bogged down by drug violence, said in a nationally televised address.

Gunmen with automatic weapons opened fire on the motorcade of the candidate, Rodolfo Torre Cantú, 46, as he headed to an event in the closing days of the campaign, the authorities said. The murders came during a rise in election-related violence in recent months, including the shooting deaths of a mayoral candidate and of an activist during a get-out-the-vote effort. Explosives have also been thrown at two separate campaign offices this month.