WASHINGTON - As senior Obama administration officials worked behind the scenes for months this year to develop the legal rationale for deferring the deportation of millions of undocumented immigrants, there was one group they wanted to include that presented particular problems: the parents of "dreamers," children who had been brought into the country illegally.

The dreamers, in the eyes of many advocates, were an especially sympathetic group, who had been granted temporary relief under the president's 2012 Deferred Action for Childhood Arrivals program. Now these advocates were saying the parents deserved similar relief as well.

The administration sought a way to include them, but attorneys from the Department of Homeland Security, Justice Department and White House examined the legal arguments and decided against it.

"We looked at this pretty hard," said one senior administration official in an interview last week, speaking on the condition of anonymity to discuss internal administration deliberations. "We hoped to come up with a rationale that would work but concluded that we couldn't."

A lawyer briefed on the administration's internal debate said when it came to that category, "Some of the policy people were pushing too hard to do things the lawyers thought were questionable." Ultimately, the lawyers won.

The decision to exclude the parents of dreamers - along with all agricultural workers and seekers of H-1B visas, which allow U.S. employers to temporarily employ foreign workers in specialty occupations - from President Obama's executive actions last week highlights the legal and political challenges the administration is navigating as it aims to curb the ongoing deportation of illegal immigrants.

The president has faced criticism from all sides on the issue, with conservatives accusing him of giving amnesty to law-breakers and immigration advocates decrying what they see as excessive deportations.

Operating in an arena that is typically shielded from judicial review, federal government attorneys have tried to broaden the number of people who can stay in the United States while shying away from the kind of overreach that could give Congress grounds to overrule the policy.

The executive-action changes have already drawn sharp rebukes from GOP lawmakers. In an interview last week, Rep. Paul Ryan (R., Wis.) called it "an act of nullification" that oversteps the president's authority. But some of the finer legal distinctions drawn by the administration aim to blunt that criticism and keep the policy in place.

The administration's legal reasoning for its actions is laid out in a 33-page memo issued by the Justice Department's Office of Legal Counsel on Nov. 19 - a road map to the choices Obama's deputies made along the way as they navigated contested legal terrain.

At the heart of the administration's justification is the idea of prosecutorial discretion. The memo is full of references to historical and judicial precedents intended to bolster the idea that the president had some discretion deciding which illegal immigrants should be expelled from the country and which should be protected from deportation, but it also acknowledged that the sustainability of such a policy rests in the political arena.

"And because the exercise of enforcement discretion generally is not subject to judicial review . . . neither the Supreme Court nor the lower federal courts have squarely addressed its constitutional bounds," states the memo. "Rather, the political branches have addressed the proper allocation of enforcement authority through the political process."

There was broad agreement among Obama's lawyers that he had the authority to expand the deferred program to parents of U.S. citizens and legal permanent residents.

Both Obama's previous actions, and some undertaken by past presidents of both parties, offered a partial legal basis for the administration's action. Presidents dating back to Dwight D. Eisenhower have granted relief to immigrants who otherwise would have been vulnerable to deportation. Republicans, however, argue those actions were on a much smaller scale.

In terms of prioritizing which immigrants should be removed from the country, Congress had already placed criminals at the top of the list. In addition, it had recognized there is a humanitarian justification for keeping families together - this serves as part of the basis for why the relatives of legal immigrants get a higher priority in terms of their visa applications. So both of those directives made it easier for government lawyers to make the parents of U.S. citizens and legal permanent residents eligible for a deferral.

More broadly, on multiple occasions in the past, the U.S. government has allowed individuals out of compliance with U.S. immigration rules - including thousands of foreign students who were stranded here after Hurricane Katrina in 2005, and relatives of those killed in the 9/11 attacks - to stay in the country.

But the administration's attorneys also made some arbitrary distinctions as they ruled which parents would be eligible for the new deferral program. They determined that only parents who had been in the country since Jan. 1, 2010, and had a qualifying child as of Nov. 19 would be granted a temporary reprieve, a similar time requirement to DACA applicants who also had to have been in the country for at least five years to be eligible for a deferral.