Both Democratic candidates Hillary Clinton and Bernie Sanders spoke passionately about the desire to stop deporting immigrants who entered the country illegally and to provide a path to citizenship at The Washington Post/Univision debate in Miami. (Sarah Parnass/The Washington Post)

Hillary Clinton’s pledge not to deport any illegal immigrants except violent criminals and terrorists represents a major break from President Obama, and it could vastly increase the number of people who would be allowed to stay in the country.

The declaration this week from the Democratic presidential front-runner drew praise from immigrant rights groups, which have largely given up hope on pushing legislation that would create a path to citizenship for the nation’s 11 million illegal immigrants. Many activists have sought in recent months to push Obama and his potential Democratic successors for stronger executive actions.

Clinton’s position, which she described during Wednesday’s Washington Post-Univision debate, gives her an effective way to energize Hispanic voters, particularly in contrast to calls by Republican front-runner Donald Trump for mass deportations. But it was not clear Thursday whether, as president, she would be able to keep the promise.

The Supreme Court is expected to set an important marker testing the White House’s power in deciding how to enforce border laws when it rules on the constitutionality of Obama’s program to grant work permits to millions of illegal immigrants. A ruling is expected as early as June.

Conservative critics of Obama’s policies suggested that Clinton has opened the door to far greater leniency and lax enforcement.

“This really is a breathtaking step toward open borders,” said Mark Krikorian, executive director of the Center for Immigration Studies, which supports lower immigration levels. “If you take that step, it needs to be put in front of the public: Do you think immigration laws are irrelevant unless the illegal immigrant has committed a violent offense or drug crime?”

Advocates hailed Clinton and Sen. Bernie Sanders of Vermont, her rival for the Democratic nomination, who joined Clinton on Wednesday night in expressing a desire to break from Obama’s policies.

The government’s deportation policies have been a source of controversy for much of Obama’s tenure.

In announcing a series of executive actions in November 2014, Obama said that his administration would no longer target illegal immigrants who have not committed other crimes, instead ­prioritizing the deportation of ­“felons, not families.”

The only exception, in new guidelines issued by the Department of Homeland Security, were immigrants who arrived illegally since Jan. 1, 2014, including a surge of tens of thousands of women and children who entered the United States after fleeing violence and corruption in Central America.

The administration’s decision to deport those who do not qualify for political asylum has angered immigrant rights groups, especially after the Department of Homeland Security conducted a series of enforcement raids on women and children in January.

“The fact that both [Clinton and Sanders] had the wherewithal to say we should not deport children, as a stark contrast to the Obama administration, and that both mentioned they agreed with the president on most things except on this was very powerful and very important,” said Marielena Hincapie, executive director of the National Immigration Law Center.

At The Washington Post/Univision debate in Miami, Democratic presidential candidates Bernie Sanders and Hillary Clinton panned Donald Trump, vowed to reform immigration and sparred over their respective records. (Sarah Parnass/The Washington Post)

Immigration lawyers said they believed Clinton’s pledge would be well within the law. Though the Supreme Court is reviewing Obama’s work-permit program, Clinton’s action would be an administrative directive to broaden the DHS enforcement guidelines but would not necessarily add more work permits, the legal experts said.

“I didn’t hear anything troubling legally at all,” said David Leopold, an immigration lawyer in Ohio who has worked on cases involving undocumented immigrants. He said the Obama administration has taken “an overly rigid view of their own priorities.”

“What I heard Clinton say is ‘I will not return children to violence,’ ” Leopold said.

A White House spokesman declined to comment Thursday, citing past statements from the administration defending its policies. Obama aides have said their decision to deport those who recently crossed the border is aimed at discouraging a surge of additional undocumented immigrants and sending a message of deterrence to those considering making the dangerous journey north.

Clinton’s move to the left of Obama on immigration marks a rare moment in which she is seeking to distance herself from a president whose Cabinet she served. In recent months, she has tried to fire up African American voters to back her over Sanders by presenting herself as a guardian of Obama’s legacy. In separating herself from Obama on deportations, she is seeking to galvanize the fast-growing Latino and Asian American voting blocs, which overwhelmingly supported Obama in 2008 and 2012 but have demonstrated frustration with the president over deportations.

Clinton had previously denounced the administration’s enforcement raids. On Wednesday, she went further when she told Univision anchor Jorge Ramos: “I would not deport children. I do not want to deport family members either, Jorge. I want to, as I said, prioritize who would be deported: violent criminals, people planning terrorist attacks, anybody who threatens us. That’s a relatively small universe.”

Sanders said during the debate that he agreed with Obama on many issues but “he is wrong on this issue of deportation.” Sanders emphasized that the Central American nations were the “most violent region in our hemisphere” and that children from that region should be allowed to stay in the United States.

Ramos, a leading advocate for immigrant rights, told The Post in a Thursday interview that the willingness of the two Democratic presidential candidates to distance themselves from Obama on deportations was “big, big news.”

Ramos said the deportation of more than 2 million immigrants during Obama’s tenure was a “silent tragedy for many Hispanic families.” He said his questioning at the debate reflected a shift in tactics for the immigrant rights community, which has long focused on a comprehensive legislative overhaul of border-control laws that includes a legal path to citizenship for undocumented immigrants.

Disappointed by the high-profile failure of bipartisan efforts in Congress during the George W. Bush and Obama administrations, advocates said their priority is now focused on winning deportation protections for those already in the United States before figuring out a new legislative strategy to get them full legal status and, ultimately, citizenship.

“Whoever the next president is, he or she cannot do anything [on comprehensive reform] without bipartisan support,” Ramos said. “That may not happen for many years. The next battle for many Latino organizations has to do with the deportations.”

Supporters of the Obama administration have defended the president’s approach by suggesting that he needed to be tough on deportations in order to persuade Republicans, who have called for greater border security, to negotiate over a comprehensive bill.

But immigrant rights advocates said the evidence during Obama’s tenure is that such an approach is foolhardy.

“That is a failed strategy,” Hincapie said. “After seven, almost eight years, there is very little patience for that among immigrant communities.”