Several weeks ago a Mexican federal judge ordered Tijuana Mayor Juan Manuel Gastelum to stop being hostile to migrants on the caravan that started in Honduras.

The ruling bans Tijuana officials from “issuing statements contrary to the protection of and respect for migrant people."

Gastelum, a 65-year-old attorney, is not listening.

Called “Tijuana Trump,” Gastelum repeatedly has expressed his objections to the caravan and called for its organizers to be identified and prosecuted for taking advantage of desperate people and putting their lives at risk.

What most rankles immigration advocacy groups are his characterizations of caravan migrants -- thousands of whom have arrived in Tijuana, overwhelming its shelters and other resources – as invaders and criminals.

In local interviews, Gastelum, who occasionally has worn a “Make Tijuana Great Again” hat, said the caravan included “pot smokers, bums and bad people.”

“Tijuana is a city of migrants but we don’t want them [arriving] in this way. It was different with the Haitians, they had [immigration] papers, [their arrival] was orderly, it wasn’t a horde, excuse the expression . . .” he said, according to the Mexico News Daily. “These people arrive in an aggressive, rude way, chanting, challenging the authorities, doing what we’re not accustomed to doing in Tijuana . . . I don’t dare to say that it is all the migrants but there are some who are bums, pot smokers, they’re attacking families in [the beachside borough] Playas de Tijuana, what is that?”

Recently, a human rights coalition called on Gastelum to apologize for his attacks on the migrants. Gastelum essentially responded that they should not hold their breath.

“No, no, I’m not going to apologize,” he said, according to the San Diego Union-Tribune “Better that those who are against Tijuana apologize to us.”

“Tijuana is a migrant town,” he told the newspaper. “We’re barely 129 years old. My mom was a migrant. My grandparents were migrants. So, we are not afraid of migration. What we do not want is bad behavior.”

Gastelum’s in-your-face style was unpopular among many residents when he won the mayoral election in 2016 with just a third of Tijuana’s 1.29 million voters casting ballots.

POLICE IN RIOT GEAR LINE UP AT BORDER TO GREET MIGRANT CARAVAN AS US VOWS: 'WE STAND READY'

His approval ratings had been extremely low – only four percent -- the San Diego Union-Tribune reported, almost since he began his term.

But then the caravan of thousands from Honduras – and thousands more joining them along the way in El Salvador and Guatemala – headed toward Mexico, and many toward Tijuana, specifically, and suddenly many frustrated residents of the border city found Gastelum’s unvarnished and provocative style appealing.

Now, Gastelum is the front-runner in the mayoral election.

Tijuana is a migrant town. We’re barely 129 years old. My mom was a migrant. My grandparents were migrants. So, we are not afraid of migration. What we do not want is bad behavior. — Tijuana Mayor Juan Manuel Gastelum

Victor Alejandro Espinosa, a political analyst at Tijuana’s Colegio de la Frontera Norte, likened Gastelum’s focus on the caravan and its popularity with voters to Trump’s speeches about the border and its appeal to his base.

“It is a shame, but this could help explain the positive trajectory of support for the mayor among this segment of the Tijuana population,” he said.

Gastelum’s critics say he is exploiting the transgressions and crimes of a small group – less than 300 out of some 6,000 who have ended up in Tijuana -- to smear the entire caravan of migrants who are fleeing violence and poverty.

They say that most of the crimes that Gastelum frequently speaks about are drug possession and being drunk in public.

CLICK HERE TO GET THE FOX NEWS APP

Enrique Morones, the president of San Diego-based Border Angels, a human rights group, said that Gastelum’s rhetoric encourages violence.

“How dare he call the migrants criminals, bringing diseases. He is promoting violence,” Morones said to the newspaper. “Hate words lead to hate actions.”

Gastelum takes aim at Mexico’s national officials for being, as he sees it, too tolerant of the caravan at Tijuana’s expense.

“I’m not going to compromise Tijuana’s economic resources to fulfill a wish of the federal government to try to show themselves as very humanitarian,” he said.

“Why don’t they escort them to Ciudad Juarez or Nogales or Agua Prieta? No, instead they escort them here?” he asked.