Mayor Lori Lightfoot said Friday her refusal to sign an executive order that would add a layer of protection from federal immigration raids stems from demands that she also abolish the Chicago Police Department’s error-filled gang database.

Several immigrant rights groups this week renewed their call for the mayor to sign an executive order barring the Department of Homeland Security and any of its agencies from accessing city databases. While Lightfoot promised the city will not assist Immigration and Customs Enforcement agents, the groups say an executive order would carry more weight.

Anxiety in Chicago’s immigrant communities has risen this week as the federal government announced that ICE intends to arrest as many as 2,000 people without documentation beginning Sunday.

“It’s not a hesitation. It’s doing it in a thoughtful way that’s actually going to recognize the need for intelligence, but do it in a way that is transparent, that if somebody gets on it, they’re gonna be able to get off without having to hire a lawyer,” she said.

“It would be easy to pander to the crowd. But I want to do this in a way that’s actually gonna be meaningful and structural and lasting. And that can’t be done overnight. We’re working diligently on it. We’ll get to that point. But we want to do it in a way that is actually gonna be meaningful. Not just say something that doesn’t really have any real effect.”

Lightfoot noted that it’s not just one database. It’s more like “eight different databases.”

That makes it infinitely more complicated to determine what information is “law enforcement-related,” how it can be collected and establish “accountability and auditing so people don’t get on it one year and, decades later, they’re still on it,” the mayor said.

“If you think about terrorism. — which as mayor, I do think about. I worry about — there can be legitimate purposes for collecting that data. But that’s the rub: legitimate purposes,” she said.

“We have incidents where people get into the database because they got into a fight at school. . . . Are you kidding me? That doesn’t make any sense. Unraveling that and having thoughtful protocols . . . takes some time,” she said.

“I understand there’s a lot of unrest amongst the activists. But my responsibility is to do my job in a way that does justice to everybody involved. And that’s what I’m gonna do.”

Hours later, Lightfoot announced, what she called a “package of executive actions” aimed at appeasing activists by providing “additional protections and resources” for immigrants living in fear.

The $1.3 million Legal Protection Fund created by former Mayor Rahm Emanuel to assist immigrants threatened with deportation will be increased by $250,000 or nearly 20 percent.

The city will terminate ICE access to CPD databases related to federal immigration enforcement activities and reaffirm its commitment not to cooperate with or facilitate the round-up of Chicago immigrants.

And city-owned schools, libraries, senior citizen centers and Chicago Park District facilities will be directed to “prevent ICE agents from entering” their buildings without a “verified, criminal warrant,” City Hall said.

The Legal Protection Fund is operated in partnership with the National Immigrant Justice Center and The Resurrection Project.

It was created three years ago with money left unclaimed from the $20 million set aside for a token property tax rebate that attracted only 17,000 takers.

At the time, African American aldermen complained that impoverished South and West Side communities should have been first in line for the largesse.