(a) For purposes of enforcing federal immigration laws, including, if applicable, federal laws relating to the employment of illegal aliens, the legislative body of a municipality or county, or the chief law enforcement officer of the county upon approval by the governing legislative body, may enter into a written agreement, in accordance with federal law, between the municipality or county and the United States department of homeland security concerning the enforcement of federal immigration laws, detention and removals, and investigations in the municipality or county.
(b) If a memorandum of understanding with the United States department of homeland security is executed pursuant to subsection (a), municipal and county law enforcement officers shall be designated from local law enforcement agencies who, by written designation and recommendation of a commanding officer, shall be trained pursuant to the memorandum of understanding. Funding for the training shall be provided pursuant to the federal Homeland Security Appropriation Act of 2006, P. L. 109-90, or subsequent federal funding sources.