CALAIS, France — French President Emmanuel Macron fired back Tuesday at criticism from his political allies over the way he has handled the country's migrant issue — a controversy that has ballooned into the first real crisis of his young presidency.

Before his election in May, Macron campaigned on a platform of welcoming migrants, and many saw his victory as a repudiation of the anti-immigrant hard line of his opponent, Marine Le Pen. But after months of expulsions and police crackdowns targeting the migrant community, some of Macron's powerful supporters — particularly on the left — are signaling that they feel betrayed.

"Mr. Macron, your politics contradict the humanism that you preach," a group of his allies wrote in a scathing open letter published Tuesday in Le Monde. Among the signatories was Jean-Pisani Ferry, the president's principal economic adviser during the campaign.

On Tuesday, Macron went on the defensive in the coastal city of Calais, the symbolic epicenter of France's migrant troubles. Before an audience of local and national police officials, he dismissed his critics as urban intellectuals who lack respect for hard-working civil servants.

"Those who want to criticize the government's policies can attack the government but not its functionaries," Macron said, clearly agitated. "The civil servants of our republic have the right to respect — them, too. It's their engagement every day that makes a sense of order possible."

Most of the migrants in Calais are focused on reaching nearby Britain, but the British government will not accept them. Between 350 and 500 migrants, mostly from East Africa, remain here, according to official statistics, even though the government demolished the sprawling "Jungle" camp in October 2016, ostensibly for humanitarian reasons. Macron reiterated Tuesday that "there will be no return of the Jungle." And he vowed to crack down on aid organizations that encourage migrants to stay in Calais.

Loan Torondel, a Calais field organizer for the aid group Auberge des Migrants, rejected that characterization. "We do not encourage anyone to stay here," he said in an interview. "What we do is provide aid to the migrants who are here."

Aid groups that distribute hot meals estimate that the number of migrants in Calais and its environs is much higher than the government's figure. It's closer to 900, according to Clare Moseley, director of Care4Calais.

Macron's address came two days before a summit with British Prime Minister Theresa May where he is expected to demand that the British government shoulder more of the burden weighing on northern France.

On Tuesday, however, he concentrated on defending his tough policies. "It is our privilege to give help on the ground to those who bring sustainable humanity to the republic," he said. He went on to outline legislation to be introduced in February that will make it easier to remove those who are in France illegally and streamline the processing of asylum claims.

He also spoke with an eye to his domestic image.

In July, the new president — an avowed globalist — seemed to make good on his campaign promises of goodwill toward migrants. "From now until the end of the year, I don't want anyone on the streets, in the forests," he said at a camp in Orleans, pledging "to accommodate everyone in a dignified way" and to establish "emergency accommodation everywhere."

But some fine print accompanied those remarks: Macron was technically referring only to political asylum seekers, not people seeking merely a better life. As he said in the same speech: "No country can take in all the economic migrants."

To that end, he has worked with Libyan and other African leaders, devising checkpoints overseas intended to sift asylum seekers from economic migrants and curb the total number of arrivals.

Some of his supporters say that was the only practical option. "He tried to find a compromise, and it's based on the distinction that those who are politically endangered should get priority," said Dominique Moïsi, a French foreign-policy expert who informally advised the Macron campaign.

At home, the government has worked to implement Macron's promise to get migrants off the streets. But respecting "dignity" has not been a priority, critics say.

Over the summer, a Human Rights Watch report alleged that French riot police "routinely use pepper spray on child and adult migrants while they are sleeping or in other circumstances in which they pose no threat." Migrants in Calais recounted similar experiences to The Washington Post in June.

On Tuesday, Macron pushed back against those reports. "I find it hard to credit the idea that security forces use violence," he said. "If that's the case — and proved — it will be punished."

In December, Gérard Collomb, Macron's interior minister, authorized surprise checks on the immigration status of people housed in emergency shelters. The raids sparked outrage in the French media, with some commentators likening them to the tactics of the Vichy government, which collaborated with the Nazis during World War II in rounding up Jews.

This week, Macron appeared on the cover of L'Obs, a leading French weekly magazine, his darkened face behind a tangle of barbed wire. "Welcome to the country of human rights," the headline reads. In essays inside, several French intellectuals take sharp aim at their president. J.M.G. Le Clézio, a Nobel Prize-winning French novelist, accuses him of "an intolerable denial of humanity."

For Moïsi, the Macron campaign adviser, much of this blowback is the "extreme" response of a disgruntled political left with no actual power. France's famed Socialist Party is a shell of its former self, and Macron's centrist party, République En Marche (Republic on the Move), is a monolith in Parliament.

At the same time, the migration issue exposes the potential fault lines in Macron's somewhat amorphous centrist faction, which spans both sides of the political aisle. Some of the strongest advocates of Macron's policies have changed their tune.

"The values of France are threatened by the fact that, little by little, the idea has taken root that we can treat people in an inhuman way," said Jacques Attali, a prominent economist and former Macron adviser, speaking Monday on France's BFM TV.

"I was in Calais, and I saw with my own eyes the police gas migrants," he said.