Ottawa is warning Canadians planning visits to Mexico to avoid that country's border areas with the United States, lest they become caught up in escalating violence associated with drug cartels.

The Department of Foreign Affairs issued an "official warning" on its travel website Tuesday that said Mexico's northern states are to be avoided "due to continuously high levels of violence linked to drug trafficking in those areas."

The warning also said ""Canadians should avoid crossing Mexico's northern border by land, as shootouts, attacks, and illegal roadblocks may occur at any time. Criminals especially target SUVs and full-size pickup trucks for theft and carjacking."

The warning, the second-highest level of travel alert issued by the department, said Canadians should avoid non-essential travel to the Mexican states of Baja California, Chihuahua, Coahuila, Durango, Guerrero, Michoacán, Morelos, Nuevo León, Tamaulipas, Sonora, and Sinaloa.

The violence in those border states is not aimed at foreigners or Canadians in particular, but they risk getting caught up in the growing violence sparked by a government crackdown on drug cartels and shooting wars between rival gangs.

"Armed clashes between security forces and drug groups are commonplace in certain areas and can occur at any time without warning," the department warned. "Travellers could get caught in the crossfire."

The warning also applies to parts of Mexico's southern border with Guatemala.

"While Canadians are not specifically targeted, they risk being in the wrong place at the wrong time. Law enforcement and police protection are often lacking."

Ottawa has already advised Canadian travellers to exercise caution when visiting the southwest coast of Mexico, which was hit with flooding and landslides after Hurricane Karl passed through the area.

"It is highly advisable to travel to Mexico by air," the department advised.