WASHINGTON — The Justice Department sued Arizona on Tuesday, charging that the state’s new immigration law is unconstitutional and requesting a preliminary injunction to stop the legislation from taking effect.

The lawsuit says the law illegally intrudes on federal prerogatives, invoking as its main argument the legal doctrine of “preemption,” which is based on the Constitution’s supremacy clause and says that federal law trumps state statutes.

The Justice Department argues that enforcing immigration laws is a federal responsibility and says an injunction is needed to prevent “irreparable harm” to the United States.

But the filing also asserts that the Arizona law would harm people’s civil rights, leading to police harassment of U.S. citizens and foreigners. President Obama has warned that the law could violate citizens’ civil rights, and Attorney General Eric Holder has expressed concern that it could drive a wedge between police and immigrant communities.

The Justice Department also argues that the law would burden federal agencies, diverting resources from the pursuit of people implicated in terrorism, drug smuggling, gang activity and other crimes.

“The law’s mandates on Arizona law enforcement will also result in the harassment and detention of foreign visitors and legal immigrants, as well as U.S. citizens, who cannot readily prove their lawful status,” the department said.

Republican lawmakers, state officials and defenders of the Arizona law promptly condemned the lawsuit.

John McCain and Jon Kyl, Arizona’s two Republican senators, issued a joint statement saying it was “far too premature” for the Obama administration to challenge the law because it has not yet been enforced. It is scheduled to take effect July 29.

“Moreover, the American people must wonder whether the Obama administration is really committed to securing the border when it sues a state that is simply trying to protect its people by enforcing immigration law,” the statement said.

The administration “has not done everything it can do to protect the people of Arizona from the violence and crime illegal immigration brings to our state,” McCain and Kyl charged.

To support its case, Justice included declarations from Arizona law enforcement officials, including the police chiefs of Phoenix and Tucson, saying that the law would hamper their ability to effectively police their communities. The officials said crime victims or witnesses would be less likely to cooperate with law enforcement, and that officers would have to be reassigned from critical areas to implement the legislation.

“Arizonans are understandably frustrated with illegal immigration, and the federal government has a responsibility to comprehensively address those concerns,” Holder said in a statement. “But diverting federal resources away from dangerous aliens such as terrorism suspects and aliens with criminal records will impact the entire country’s safety. “