ROME — The building is seven stories tall, not far from the main train station, surrounded by cheap motels. Once, it was the bureaucratic headquarters for a government pension fund. Now, it is an illegal home for 450 people who sleep in the old office rooms, share bathroom cleanup duties, and take turns standing guard at the front entrance, ready to press an alarm button if and when authorities show up and order them to leave.

Some of the people in the building are newly arrived immigrants — the targets of a law-and-order clampdown by Italy’s populist government.

Others, though, might have expected support from a government that has promised to put “Italians first.”

“I am an Italian,” said Maurizio Zanga, 62, a laid-off garbage collector who lives on the seventh floor next to a family of Somalis. “But I am not one of the first. I am one of the last.”

If Italy’s government offers a test case of what happens when populists come to power, the threat to clear illegally occupied buildings shows how defend-the-country measures can end up hurting citizens, too.

Interior Minister Matteo Salvini — head of the far-right League party — has said all squatter buildings in Rome will be cleared, “none excluded.” The Salvini decree, as his signature policy is known, is a sweeping security measure passed by the government in November and presented as a tool to push back against migration. It also raises penalties for squatters, no matter their nationality or legal status, who can now face steeper fines and up to four years’ imprisonment.

In December, when authorities in Rome cleared a particularly ramshackle building, Salvini showed up at the site and streamed a four-hour video of the operation. He posted on Facebook that the squatters were “mostly migrants.” The video footage included an interview with a man who said he was from Gambia and would sleep on the street that night.

“Send them back to Africa,” one poster wrote below.

“Bravo, Matteo,” another said.

But the prevalence of squatters in Rome speaks not only to a five-year influx of people coming from the Middle East and Africa, but also to a generation-long economic stagnation — and the failure of one government after the next to provide a safety net.

With a dearth of public housing, in a city plagued by economic misfortune and mismanagement, 10,000 to 11,000 people live as squatters in abandoned factories, office buildings and other properties, according to city data.

Fabrizio Nizi, a housing activist, estimates that 30 to 40 percent of the squatters in Rome are Italians. Some lost their jobs before retirement age and couldn’t find new positions. Others have struggled to enter the workforce entirely. Some have applied for public housing, but the city faces a logjam, and new units are not being built.

“People wait up to 10 years for a home,” Nizi said. “You need to wait for somebody to die.”

Rome has not taken an official stance on the squatters, but a city spokesman said that “plenty of the squatted buildings put the safety of their own squatters at risk. The goal is that of offering a dignified alternative.”

Some of the buildings are in dire shape — no windows, trash everywhere. The old pension building, though, more closely resembles a tidy low-income housing complex, albeit one with no heat. The nameplates of old bureaucrats remain posted outside the office rooms. But some of the occupants have decorated their doors with stickers and art. Residents stage theater performances. Handwritten signs provide rules for a “civil coexistence.” The complex is managed by the residents with help from Action, a housing activist group.

Experts say authorities are unlikely to forcibly clear all squatter buildings, as Salvini has promised. Still, Salvini has managed to raise the anxiety everywhere.

“Day and night, my children are suffering just thinking about it,” said Gianfranco Meneghetti, 53, a resident on the seventh floor of the pension building.

Meneghetti was born in Ethiopia but is an Italian citizen. His eldest child, who is 15, sometimes asks what the family would do after eviction.

“There is nothing I can say to reassure him,” Meneghetti said.

Pension building residents said Salvini’s threats have also heightened an us-vs.-them mentality. People said they notice changes in people on the outside, or even in themselves. Some of the Italian squatters have begun to grumble about the noise and cooking odors made by families from other countries, or about how Ramadan forces changes to building meeting times, or about how foreigners beat them out for low-paying cleaning and caretaking jobs.

Sabina Aristarco, 53, an Italian who lives on the first floor, said she’d encountered employers who wanted only people from Africa.

“You’d have to put on blinders not to see the problems with migration,” she said.

At the same time, she saw the benefits to migration, too. Her closest friends in the building were non-Italian. Her partner was from Tanzania. She saw how people from all over — those fluent in Italian and those just learning — could bicker but then settle disputes at weekly building meetings.

At those events, it has been Zanga who often played mediator — stepping into others’ arguments with the gruff and avuncular demeanor of the union boss he once was.

He was established in his career with a waste management company when he was told, in January 2016, that he no longer had a job. He asked his wife and son to go to Colombia, his wife’s home country, where they had family to help them. Zanga tried to stay afloat. Unemployment benefits kicked in, but the payments dwindled month by month until they reached zero. By early 2017, he could no longer pay his rent. By mid-2017, authorities were at his door with an eviction notice. He sold a Sony television for about $100 to pay for a moving van. Then, with his last possessions — a bed, a robot vacuum cleaner, artwork portraying a Tibetan bridge that he says helps him relax — he showed up on the seventh floor. He told almost none of his family and friends what was happening to him.

“I had a normal life. Books, furniture,” he said, with money to spend to have pizza nights with friends. “Here, I’ve closed myself off.”

Zanga said that falling to the bottom rung has prompted him to gradually reevaluate his views. Until several years ago, he said, he was a “false Democrat,” somebody whose opinions hadn’t yet been tested by hardship. Sometimes, he curses to himself about some of the foreigners living around him, who tend to be younger and have larger, noisier families.

“I have become a bit of a jerk in here. Sometimes I feel like saying, ‘Go back to your own country,’ ” Zanga said. “And then I think to myself, what . . . are you saying?”

But Zanga still doesn’t grasp the goal of clearing out squatters entirely. If he’s kicked out, where would he go? Under a bridge? Another squatter building? For him, there is no country to return to.

“If we were kicked out tomorrow, you still haven’t solved the problem,” Zanga said. “Without a doubt the [government] is reducing the spaces for humanity. Those with a normal social life are inside the fortress. And those who are poor are on the outside.”