The president has sent federal agents to Democratic-led cities in several states, prompting lawsuits and stirring anger among local leaders.