PHOENIX (Reuters) - A judge on Wednesday blocked key parts of Arizona’s tough new immigration law hours before it was to take effect, handing a victory to the Obama administration as it tries to take control of the issue.

Arizona Governor Jan Brewer said she would file an appeal to reinstate the provisions, which had popular support but were opposed by President Barack Obama and immigration and human rights groups.

“This fight is far from over,” Brewer said, adding that “at the end of what is certain to be a long legal struggle, Arizona will prevail in its right to protect our citizens.”

The Republican-controlled state legislature passed the law three months ago to try to drive nearly half a million illegal immigrants out of Arizona and stem the flow of human and drug smugglers over the border from Mexico.

The provisions blocked by U.S. District Judge Susan Bolton included one requiring a police officer to determine the immigration status of a person detained or arrested if the officer believed the person was not in the country legally.

Bolton also halted provisions requiring immigrants to carry their papers at all times and making it illegal for people without proper documents to tout for work in public places.

Immigration as an issue has festered in U.S. politics for years and attempts to overhaul the system have failed, most recently in 2007 when Republicans torpedoed reforms pushed by George W. Bush, then the Republican president.

The ruling is a significant victory for Obama, who wants to break the deadlock with Republicans to pass a comprehensive immigration law tightening border security and giving millions of illegal immigrants a shot at legal status -- an already difficult task before November’s congressional elections.

There are an estimated 10.8 million illegal immigrants in the United States, a country of more than 300 million people.

The Justice Department had argued provisions of the Arizona law, which goes into effect on Thursday, encroached on federal authority over immigration policy and enforcement.

In her 36-page decision, Bolton agreed, finding “the United States is likely to suffer irreparable harm” if her court did not block the selected parts of the law.

“The number of requests that will emanate from Arizona as a result of determining the status of every arrestee is likely to impermissibly burden federal resources and redirect federal agencies away from the priorities they have established,” she said.

COULD GO TO SUPREME COURT

Bolton kept some parts of the law, including provisions making it illegal for drivers to pick up day laborers off the street and to transport or harbor an illegal immigrant.

Brewer said her state “will soon file an expedited appeal” with the U.S. Court of Appeals for the Ninth Circuit.

Arizona can appeal ultimately to the U.S. Supreme Court. In that case, it could embroil the cash-strapped desert state in a protracted and costly legal battle.

“There are no winners here,” said Representative Ann Kirkpatrick, an Arizona Democrat who faces a tough battle for re-election in November. “No matter what the courts ultimately decide, we will still have wasted millions of dollars and our borders will still not be secure.”

Slideshow ( 19 images )

About three dozen Hispanic activists attending an open-air mass outside the state capitol in central Phoenix jumped up, hugged and wept as news of Bolton’s ruling broke.

“I think that our efforts have paid off,” said Dulce Matuz, a college graduate who has lived in Arizona without papers for a decade, adding activists would carry on fighting to overturn the rest of the law.

The Mexican government hailed the ruling as a “step in the right direction.” Around 100 activists cheered and chanted “Yes we can!” and “No to xenophobia” as news of the ruling reached a rally outside the U.S. embassy in Mexico City.

State Senator Russell Pearce, the architect of the law, said he was “very disappointed” by the judge’s ruling.

Slideshow ( 19 images )

“What she did was decide to insert some opinion into the law rather than rule on what is the law of the land, and that’s not right,” Pearce told Reuters. “But we will win on appeal.”

“WIND OUT OF SAILS”

Peter Spiro, a law professor at Temple University in Philadelphia and a former attorney in the State Department, said he was not surprised the more controversial provisions were stopped.

“I expect those provisions will never go into effect, though this is only a preliminary order,” Spiro said.

“I also think this will take the wind out of the sails of anti-immigration efforts on the state level, though it will probably intensify such efforts at the federal level.”

Polls show the Arizona law is backed by a solid majority of Americans and by 65 percent of the state’s voters. It is inspiring copycat efforts in at least 20 other states.

Obama supports allowing illegal immigrants in good standing to pay a fine, learn English and get on the track to citizenship. He also has supported tightening border security and clamping down on employers that hire undocumented workers.

Opponents of the Arizona law say it will lead to harassment of Hispanic or Hispanic-looking Americans. Thousands were headed to Phoenix for protests on Thursday, when the law takes effect, and street rallies were planned across the country.

Police across Arizona, the principal corridor for human and drug smugglers entering the United States from Mexico, have been preparing to implement the law.

The state’s 15,000 officers have had training on how to identify people they suspect are unlawfully in Arizona without resorting to racial profiling, Brewer had said on Tuesday.

“Racial discrimination is illegal,” Brewer said on CNN’s Larry King Live show. “It’s illegal in the United States, it’s illegal in Arizona. It has been and it will continue to be.”