U.S. Attorney General Eric Holder. (Chip Somodevilla/GETTY IMAGES)

Attorney General Eric H. Holder Jr., depressed about his isolation in the Obama administration, growing criticism by the media and his mother’s death, considered resigning two years ago, according to a book being released Tuesday.

Valerie Jarrett, senior adviser to President Obama and a Holder friend, persuaded him to stay, according to Daniel Klaidman in “Kill or Capture: The War on Terror and the Soul of the Obama Presidency.”

“This will not be good for you and it will not be good for your friend, the president,” Jarrett told Holder in a scene recounted by Klaidman, a Newsweek special correspondent and the magazine’s former managing editor.

Although that period in his tenure was marked by tension, Holder’s relationship with the White House has improved greatly since the departure of two senior aides, Obama’s chief of staff Rahm Emanuel and his senior adviser David Axelrod, several former and current Justice Department officials said Monday. “Now, Eric Holder is very comfortable wearing the mantle of attorney general, because he feels he has allies within the White House and not the detractors he had before,” said one former Justice official, who spoke on the condition of anonymity to discuss internal matters.

Holder’s relationship with congressional Republicans also has been rocky, and he came under fire last year for the gun operation Fast and Furious. More than 100 GOP lawmakers have called for his resignation and Rep. Darrell Issa (R-Calif.), chairman of the House Oversight and Government Operations Committee, threatened contempt of Congress charges.

Justice officials said that Holder has weathered the storm and that the GOP attacks have paled in comparison to the early conflicts within the administration.

“There’s a difference in feeling like there’s people on the outside aiming for you than people on the inside aiming for you,” said a Holder confidant. “He’s in a good and strong place now.”

In the first years of the Obama administration, Klaidman wrote, Holder was engaged in lonely and often unsuccessful battles with senior White House aides over a range of issues, from his public comments on guns and race to his decision about where to try alleged Sept. 11 mastermind Khalid Sheik Mohammed. White House staff members saw Holder as “politically inept,” while Holder and his aides believed the White House was too timid about engaging with Congress and fighting for what it believed in, Klaidman wrote.

Through a spokeswoman, Holder declined to comment about the book. The White House also declined to comment.

Obama’s affection and close friendship with Holder bred resentment within the White House, especially with Emanuel, who tried to muzzle him, Klaidman wrote.

It increasingly irritated Emanuel that Holder was able to go around him on sensitive Justice matters and talk directly to the president in social settings. Not only did Obama respect Holder professionally, but they had a close personal bond and similar worldviews, their wives were friends and they frequently socialized together, Klaidman wrote.

Holder also had a difficult relationship with Axelrod, who is now Obama’s senior campaign strategist, according to the book.

After one White House meeting, Axelrod told Holder that he wanted to place someone on Holder’s staff who had sharper political instincts and could communicate better with the White House. Holder was furious that the White House wanted to “assign a minder to him,” the book said.

A few days later, Axelrod told Holder that he was incensed that the attorney general and his aides were complaining that Axelrod was improperly trying to influence the department. “Don’t you ever, ever accuse me of trying to interfere with the operations of the Justice Department. I’m not Karl Rove,” Axelrod told Holder, referring to President George W. Bush’s senior aide, who had been accused of interfering at Justice.

Holder disagreed, using an expletive, Klaidman wrote. “The two men stood chest to chest. It was like a school yard fight.”

Jarrett, who witnessed the confrontation, got between the two men and ordered them to “take it out of the hallway.”

On CBS’s “Face the Nation” on Sunday, Axelrod denied interfering with the Justice Department. “Eric Holder is a great friend of mine,” he said. “We may have gone chest to chest back in the day. But we have a strong relationship.”

Staff writer Julie Tate contributed to this report.