All law enforcement agencies in Florida will have to cooperate with federal immigration authorities under a bill signed by Gov. Ron DeSantis on Friday during a ceremony that often felt like a campaign rally for him and President Donald Trump.

The legislation prohibits local governments from enacting "sanctuary" polices that protect undocumented immigrants from deportation — which no Florida cities had actually done. Local law enforcement will be required to honor U.S. Immigration and Customs Enforcement detainers for undocumented immigrants who are arrested or convicted of a crime. The bill exempts crime victims and witnesses.

"Sanctuary cities basically create law-free zones where people can come to our state illegally and our country illegally, commit criminal offenses and then just walk right out the door and continue to do it," DeSantis said. "In Florida, that will not happen."

Get Breaking News Delivered to Your Inbox

The bill was signed in the Okaloosa County Commission's meeting room with an overflow crowd dotted with red "Make America Great Again" hats. Okaloosa, in the western Panhandle, is one of the state's most conservative counties. The crowd cheered wildly in support of the bill and equally as loud at the mention of President Trump.

Mr. Trump, who has made illegal immigration a top priority, helped DeSantis win the GOP primary last year and campaigned for DeSantis in the general election. Republican U.S. Rep. Matt Gaetz, another close Trump ally who campaigned across the state for DeSantis, also spoke at the ceremony.

The bill sparked protests among immigrants and their advocates at the Capitol when it was before the Legislature. They feared it would encourage law enforcement profiling, force people to be deported for minor offenses like traffic infractions, and discourage crime victims and witnesses from coming forward. Opponents also argued that holding people based on an immigration detainer was unconstitutional.

Prior to its passage, the American Civil Liberties Union of Florida issued a statement opposing the legislation, citing constitutional and civil rights concerns.

"[It] broadly bans all policies and procedures and requires every Florida county and municipality to expend maximum local resources to enforce federal immigration law," the ACLU of Florida said. "Moreover, it does not provide any funding or reimbursement for its costly mandate."

The ACLU of Florida also issued a "travel alert" warning immigrants against traveling to the state because of the risk of detention.