WASHINGTON — The Justice Department is siding with Texas in a lawsuit over the state's new "sanctuary cities" law, according to a statement of interest filed in federal court on Friday.

Several cities have gone to court, hoping to block the law which prohibits local governments in Texas from enacting policies that prevent local officials from sharing immigration-related information with the federal government. The law also directs local officials to cooperate with requests issued by the federal government to detain people who may be in the U.S. illegally.

Some Texas law enforcement officials have said the new measure will make it tougher to keep communities with high immigrant populations safe, undercut relationships with those groups and deter the victims and witnesses of crimes from coming forward out of fear of deportation.

The Justice Department argues that federal law does not preempt the legislation, known as "SB4", and that it is not unconstitutional.

“President Trump has made a commitment to keep America safe and to ensure cooperation with federal immigration laws. Texas has admirably followed his lead by mandating state-wide cooperation with federal immigration laws that require the removal of illegal aliens who have committed crimes," Attorney General Jeff Sessions said in a statement accompanying the filing.

“The Department of Justice fully supports Texas’s effort and is participating in this lawsuit because of the strong federal interest in facilitating the state and local cooperation that is critical in enforcing our nation’s immigration laws.”

In April, Sessions blamed lax immigration enforcement for a crime spike in so-called sanctuary cities, which frustrated law enforcement officials in such cities as New York. And in March, the Justice Department released a list of local law enforcement offices that had declined federal detainer requests to hold undocumented immigrants.