When Peter Brown turned himself in to his local Florida sheriff’s office earlier this year, he had no idea he was about to experience a weeks-long nightmare that would lose him his job and nearly see him deported to a country he had been to for all of one day in his life.

Instead of returning home and to his job at Key West’s Fogarty’s restaurant with a court date for a probation violation after he tested positive for marijuana in April, Mr Brown – a US citizen – was informed by deputies that US Immigration and Customs Enforcement (ICE) had flagged him as an illegal alien from Jamaica. The agency wanted to deport him, and had asked through an immigration detainer that he be kept in custody until federal authorities could arrest him.

Mr Brown’s experience illustrates the dangers posed by cooperation between federal and local law enforcement, which has been championed by the White House as part of President Donald Trump’s opposition to “sanctuary” cities that do not cooperate with federal immigration authorities.

“It’s one of those things that will never leave your memory. It’s just, there’s a feeling you get in the pit of your stomach at that moment when you’re not being believed, and you’re about to be sent to a country that you’re not from,” Mr Brown, who had previously been detained by ICE’s predecessor in the 1990s under similar mistaken identity circumstances, told The Independent. “It totally just negates everything you’ve been raised on in this country believing in the rights that we have.”

During his three weeks in police, and then ICE, custody, Mr Brown repeatedly offered to provide proof of his American citizenship while deputies had the proof they needed in their own records, including an all-caps form entry that Mr Brown was born in “PHILADELPHIA” and his Florida drivers licence, which can only be obtained by American citizens and people living in the US legally.

While Mr Brown wrote repeated letters to the sheriff, he said he was mocked by deputies. At one point, he said, officers sang the theme song for “The Fresh Prince of Bel Air”, which references being “born and raised” in West Philadelphia.

An emailed statement from Monroe County Sheriff Richard Ramsay noted that Mr Brown had originally been arrested on separate matters unrelated to ICE, that the agency had informed his office Mr Brown had been confirmed via a fingerprint match, and claimed he was legally obligated to honour immigration detention requests.

“Local law enforcement throughout this country has been caught in the middle of a political argument regarding immigration,” Mr Ramsay said. “Although I can’t respond as much as I would like on this case given the pending litigation, I always strive for transparency with the public, which all of us here at the Sheriff’s office serve.”

“This does happen pretty often, shockingly,” Sarah Rich, an attorney with the Southern Poverty Law Centre (SPLC), which is representing Mr Brown alongside the American Civil Liberties Union (ACLU) in a lawsuit against Monroe County Sheriff Richard Ramsay, said. “In fact, it happened to Mr Brown once before in his life.”

People strike across America for A Day Without Immigrants Show all 16 1 /16 People strike across America for A Day Without Immigrants People strike across America for A Day Without Immigrants Demonstrators march during the "Day Without Immigrants" protest in Chicago, Illinois, February 16, 2017. Theopolis Waters/Reuters People strike across America for A Day Without Immigrants Demonstrators march during the "Day Without Immigrants" protest in Washington, DC, U.S., February 16, 2017. Aaron P. Bernstein/Reuters People strike across America for A Day Without Immigrants Protesters march in the streets outside the Texas State Capital on 'A Day Without Immigrants' February 16, 2017 in Austin, Texas. The crowd, which grew to well over a thousand participants, marched from the Austin City Hall to the Texas State Capital. Across the country hundreds of restaurants and eateries are closing for the day to protest President Trump's immigration policies and to highlight the contributions of immigrants to U.S. business and life. Drew Anthony Smith/Getty People strike across America for A Day Without Immigrants Protesters march in the streets outside the Texas State Capital on 'A Day Without Immigrants' February 16, 2017 in Austin, Texas. Drew Anthony Smith/Getty People strike across America for A Day Without Immigrants AUSTIN, TX - FEBRUARY 16: Protesters march in the streets outside the Texas State Capital on 'A Day Without Immigrants' February 16, 2017 in Austin, Texas. Drew Anthony Smith/Getty People strike across America for A Day Without Immigrants Demonstrators march during the "Day Without Immigrants" protest in Chicago, Illinois, February 16, 2017. Theopolis Waters/Reuters People strike across America for A Day Without Immigrants Demonstrators march during the "Day Without Immigrants" protest in Chicago, Illinois, February 16, 2017. Aaron P. Bernstein/Reuters People strike across America for A Day Without Immigrants Protesters march in the streets outside the Texas State Capital on 'A Day Without Immigrants' February 16, 2017 in Austin, Texas. The crowd, which grew to well over a thousand participants, marched from the Austin City Hall to the Texas State Capital. Across the country hundreds of restaurants and eateries are closing for the day to protest President Trump's immigration policies and to highlight the contributions of immigrants to U.S. business and life. Drew Anthony Smith/Getty People strike across America for A Day Without Immigrants Protesters march in the streets outside the Texas State Capital on 'A Day Without Immigrants' February 16, 2017 in Austin, Texas. Drew Anthony Smith/Getty People strike across America for A Day Without Immigrants Protesters march in the streets outside the Texas State Capital on 'A Day Without Immigrants' February 16, 2017 in Austin, Texas. Drew Anthony Smith/Getty People strike across America for A Day Without Immigrants Protesters march in the streets outside the Texas State Capital on 'A Day Without Immigrants' February 16, 2017 in Austin, Texas. Drew Anthony Smith/Getty People strike across America for A Day Without Immigrants Protesters march in the streets outside the Texas State Capital on 'A Day Without Immigrants' February 16, 2017 in Austin, Texas. Drew Anthony Smith/Getty People strike across America for A Day Without Immigrants Protesters march in the streets outside the Texas State Capital on 'A Day Without Immigrants' February 16, 2017 in Austin, Texas. Drew Anthony Smith/Getty People strike across America for A Day Without Immigrants Protesters march in the streets outside the Texas State Capital on 'A Day Without Immigrants' February 16, 2017 in Austin, Texas. The crowd, which grew to well over a thousand participants marched from the Austin City Hall to the Texas State Capital. Across the country hundreds of restaurants and eateries are closing for the day to protest President Trump's immigration policies and to highlight the contributions of immigrants to U.S. business and life. Drew Anthony Smith/Getty People strike across America for A Day Without Immigrants High school student Kathia Suarez holds up a sign as she protests with others outside the Grayson County courthouse in downtown Sherman, Texas, Thursday, Feb. 16, 2017. LM Otero/AP People strike across America for A Day Without Immigrants High school senior Vicky Sosa holds a sign outside the Grayson County courthouse in downtown Sherman, Texas, Thursday, Feb. 16, 2017. In an action called "A Day Without Immigrants," immigrants across the country are expected to stay home from school, work and close businesses to show how critical they are to the U.S. economy and way of life. LM Otero/AP

Mr Brown’s detention was enforced as a part of an ICE pilot programme launched in February, and gives $50 to local sheriff and police forces for each immigrant detention request. Such requests have been used frequently since the start of the Obama administration, according to data compiled by Syracuse University, and immigration lawyers have suggested that the $50 payments take legal responsibility for the detention off of local law enforcement officials.

As a result of those immigration detainer requests, as they are known, hundreds of American citizens have been illegally kept in police custody at the request of US immigration agents. One study from Syracuse University, for example, found that ICE placed detainers on 834 US citizens over a single four year period. During that same period, the agency placed another 20,281 immigration detainees on legal permanent residents of the US with no criminal records, and were therefore not subject to deportation, according to the study.

The constitutionality of the detainers has been called into question by several courts, which have found that the tools violate the fourth amendment of the US constitution, which says that probable cause is required for search, seizure and arrest. And, in emails obtained by SPLC between Florida sheriffs prior to the rollout of the pilot programme earlier this year, even those law enforcement officials expressed concerns about the constitutionality of detainers.

Multiple emails to ICE requesting comment were not returned.

“This case, and Peter’s story, shows why local law enforcement should not be getting into the business of arresting people for ICE,” Spencer Amdur, an attorney with the ACLU working on Mr Brown’s case said. “Local police should be focusing on protecting their own communities, not doing immigration enforcement, which they’re not trained to do. It’s just going to expose them to these situations where they’re violating people’s rights and facing legal liability.”

Weeks after his original arrest in Key West, Mr Brown was loaded by ICE into a bus with other detainees and driven hours north to the Krome Detention Centre in Miami, where he and those others sat for hours waiting to be processed and were denied requests to go to the toilet.

Support free-thinking journalism and attend Independent events

Once there, Mr Brown said he renewed his efforts to convince officers that he was an American, and was met with mixed reactions from agents. One agent angrily slammed a file the size of a phonebook they claimed was his immigration file down and demanded that he admit, in writing, that he was in the country illegally, while others started to realise that a mistake had been made.

At any given moment he feared he might be deported to Jamaica – a country he had been to just once, for a few hours on a cruise, and feared going to again as a gay man due to the violent treatment of homosexuals there.

“I said, ‘There’s no way you have a phonebook-thick folder of information on me because I’m not an immigrant’,” he recalled telling the angry officer.

Finally, 22 days after his initial arrest, Mr Brown convinced ICE agents to take a look at his birth certificate, which he got his roommate back in Key West to email.

After taking the immigration papers they had given him back, Mr Brown was left alone in Miami, with no arrangements to get back. He had been uprooted, nearly deported, and dropped hours away from home.