Legal proceedings— In any legal proceeding brought against a State, a political subdivision of a State, or an officer, employee, or agent of such State or political subdivision, which challenges the legality of the seizure or detention of an individual pursuant to a detainer issued by the Department of Homeland Security under section 236 or 287 of the Immigration and Nationality Act (
8 U.S.C. 1226 and
1357)—
(2)
if the actions of the officer, employee, or agent of the State or political subdivision were taken in compliance with the detainer—
(A)
the officer, employee, or agent shall be deemed—
(i)
to be an employee of the Federal Government and an investigative or law enforcement officer; and
(ii)
to have been acting within the scope of his or her employment under section 1346(b) and chapter 171 of title 28, United States Code;
(B)
section 1346(b) of title 28, United States Code, shall provide the exclusive remedy for the plaintiff; and
(C)
the United States shall be substituted as defendant in the proceeding.