Immigration lawyers in Miami-Dade County are challenging its practice of jailing people on behalf of federal immigration authorities, in a case that could test the Trump administration’s attempts to pressure so-called sanctuary cities and counties.

In a lawsuit filed Wednesday in Federal District Court in Miami, lawyers representing a local resident, Garland Creedle, argued that the county had violated his Fourth Amendment right against unlawful seizure.

The practice at issue is one in which federal immigration authorities send requests, known as detainers, to local police departments or jails asking them to hold people they are about to release so that immigration authorities can go arrest them. During his first week in office, President Trump signed an executive order threatening to withhold billions of federal dollars from cities and counties that ignored detainers, saying that such places, sometimes known as sanctuary cities, were helping to harbor dangerous criminals.

Shortly after Mr. Trump signed the order, the Miami-Dade mayor, Carlos A. Giménez, directed his corrections department to honor the requests, saying the county could not afford to lose funding. So after Mr. Creedle, 18, posted bail in March in a domestic dispute case, which was later dropped, he was held in custody overnight on the suspicion that he was an undocumented immigrant.