Attorney General nominee Loretta Lynch gathers her papers during a break in her testimony on Capitol Hill in Washington, Wednesday, Jan. 28, 2015, before the Senate Judiciary Committee’s hearing on her nomination. If confirmed, Lynch would replace Attorney General Eric Holder.

WASHINGTON — Confronting skeptical Republicans, attorney general nominee Loretta Lynch pledged a new start with Congress and independence from President Barack Obama Wednesday, even as she defended the president's unilateral protections for millions of immigrants in the country illegally.

"If confirmed as attorney general, I would be myself. I would be Loretta Lynch," the nominee told her Senate confirmation hearing as Republicans showered criticism on the current occupant of the job, Eric Holder. They said Holder was contemptuous of Congress and too politically close to Obama, and repeatedly demanded assurances that Lynch would do things differently.

"You're not Eric Holder, are you?" Texas Republican John Cornyn, one of the current attorney general's most persistent critics, asked at one point.

"No, I'm not, sir," Lynch responded with a smile.

It was a moment that summed up a Senate Judiciary Committee hearing that was often more about Obama and Holder than about Lynch, who is now the top federal prosecutor for parts of New York City and Long Island. If confirmed, she would become the nation's first black female attorney general.

Holder, Cornyn contended, "operated as a politician using the awesome power conferred by our laws on the attorney general."

Lynch asked the senator to take note of "the independence that I've always brought to every particular matter," and she said that when merited she would say no to Obama.

On immigration, Lynch faced numerous questions from Republicans critical of the administration's new policy granting work permits and temporary deportation relief to some 4 million people who are in the country illegally. The committee chairman, Republican Chuck Grassley of Iowa, called the effort "a dangerous abuse of executive authority."

Lynch said she had no involvement in drafting the measures but called them "a reasonable way to marshal limited resources to deal with the problem" of illegal immigration. She said the Homeland Security Department was focusing on removals of "the most dangerous of the undocumented immigrants among us."

Pressed by Sen. Jeff Sessions of Alabama, a leading immigration hard-liner, she said citizenship was not a right for people in the country illegally but rather a privilege that must be earned. However, when Sessions asked whether individuals in the country legally or those who are here unlawfully have more of a right to a job, Lynch replied, "The right and the obligation to work is one that's shared by everyone in this country regardless of how they came here."

Sessions quickly issued a news release to highlight that response. Under later questioning by Democratic Sen. Chuck Schumer of New York, Lynch clarified it, stating there is no right to work for an immigrant who has no lawful status.

The hearing was the first such proceeding since Republicans retook control of the Senate in January. Although comments from Sessions and Sen. Ted Cruz, R-Texas, as the session neared its conclusion suggested her stance on immigration and presidential authority would cost some Republican support, Lynch is expected to win confirmation with little difficulty, in part because Republicans are so eager to be rid of Holder. He has been a lightning rod for conservatives over the past six years, clashing continually with lawmakers and becoming the first sitting attorney general to be held in contempt of Congress.

Lynch found occasions to differentiate herself from Holder without contradicting him.

She stated without hesitation under questioning from Sen. Lindsey Graham, R-South Carolina, that she considers the death penalty an effective punishment and has sometimes sought it in her district. That was a rhetorical shift from Holder, who has expressed personal reservations about capital punishment, particularly in light of recent botched executions, but has also sought it in past cases.

On another controversial topic, Lynch said current National Security Agency intelligence-gathering programs are "constitutional and effective." She said she hopes Congress will renew three expiring provisions in the Foreign Intelligence Surveillance Act, which allows the FBI to obtain search warrants and communications intercepts in intelligence cases.

Questioned by Graham and other senators who are concerned that the use of civilian courts to try terrorists would give them too many rights, she said both military tribunals and civilian trials should be available for such prosecutions.

She also was asked whether she would support efforts to legalize marijuana. She said emphatically that she wouldn't, and refused to endorse a viewpoint offered by Obama in a New Yorker article last year that marijuana was not more dangerous than alcohol.

"I certainly think the president was speaking from his personal experience and personal opinion," not reflecting Justice Department policy, Lynch said.

Beyond his clashes with Congress, Holder has faced accusations from critics that he has aligned himself more with protesters alleging police violence than with members of law enforcement, a contention he and the Justice Department have strongly denied.

It's an area Lynch is familiar with. She helped prosecute New York City police officers who beat and sexually assaulted Haitian immigrant Abner Louima in 1997, and her office in New York is currently leading a civil rights investigation into the police chokehold death of Eric Garner in Staten Island last summer. Lynch has been U.S. attorney for the Eastern District of New York since 2010, a role she also held from 1999 to 2001.

Lynch told senators that one of the most important issues facing the country is "the need to resolve the tensions ... between law enforcement and the communities that we serve." She said the best way to deal with the problem is to get all parties to meet and talk, "helping them see that, in fact, we are all in this together."

Lynch was accompanied at the hearing by about 30 family members and friends. Her mother was unable to make the trip, but her father, a retired minister, sat behind her throughout the hearing along with her husband, her brother and several members of her college sorority, Delta Sigma Theta, wearing their trademark bright red.