In reminiscing about his time in office and the advice he has received along the way, President Obama often cites an early warning passed on by the Washington veteran he decided to keep in his first Cabinet: Robert Gates.

“Every day,” Gates told Obama in the first weeks of his presidency, “someone, somewhere, in the federal government is screwing up.”

Now it turns out that Gates often believed that person was Obama — or, at least, some of those very close to him.

With the impending publication of a memoir that is critical of the president and some of his top advisers, Gates has highlighted the risk Obama took by building a jostling, ambitious, big-intellect “team of rivals” to advise him.

The former defense secretary, a holdover from the George W. Bush administration, has called into question Obama’s commitment to his Afghanistan war policy, criticized how political calculation influenced national security decisions and complained about the president’s distrust of the uniformed military command.

An exercise in therapeutic truth-telling, perhaps, but also rough and in some ways unexpected treatment from a former friend.

Even before official publication, the reception of “Duty: Memoirs of a Secretary at War” is splitting along partisan lines, reinforcing and deepening the perceptions of the administration that have hardened over the years.

Conservatives see a politically motivated White House and a president who couldn’t decide what to do in Afghanistan, choosing a half-measure and escape plan instead of a strategy to win. Liberals see a president unafraid of the military and eager to reflect the country’s growing antiwar sentiment, focusing instead on economic problems at home.

In that sense, Obama probably faces little lasting political damage from the account. But there are other implications that go to the personality of this president and of his senior advisers.

Since taking office, Obama and his loyal inner circle, small and largely stagnant in composition over the years, have been accused of insularity at best and a paranoid “us vs. them” mentality at worst.

Only veterans of Obama’s U.S. Senate office or of his surprising victory in the 2008 Iowa caucuses were trusted implicitly as the administration took shape. Others — but only a very few others — worked their way in with loyalty and long hours.

Obama has never acknowledged the criticism’s validity, but he has discussed the need to open up his administration to more outside voices and to new advisers — if for no other reason than because some of his longest-serving ones are now departing or near exhaustion.

This year, after the difficulties of the past one, was envisioned as an opportunity to do so.

But just as the Gates memoir is reinforcing partisan views about Obama, it may also serve as a kind of vindication of the opinion that only a select few longtime advisers can be trusted to serve him.

The circle of trust

The effect may be a West Wing even more leery of outsiders, with Gates as the latest evidence to support the just-because-we’re-paranoid-doesn’t-mean-they’re-not-out-to-get-us sensitivity in Obama’s inner circle.

In the memoir, Gates writes that he was “put off by the way the president closed the meeting,” referring to one devoted to Iran’s nuclear program and Israel’s concerns about it.

“To his very closest advisers, he said, ‘For the record, and for those of you writing your memoirs, I am not making any decisions about Israel or Iran. Joe you be my witness,’ ” Gates writes of Obama. “I was offended by his suspicion that any of us would ever write about such sensitive matters.”

Duty” hits bookstores next week.

White House officials say the feeling in the West Wing about Gates’s assertions is a sense of disappointment more than betrayal. The book is a distraction at a time when postwar Afghanistan plans are in flux, fallout from National Security Agency disclosures are roiling diplomatic relations and Iraq is surging with violence, they say.

“The irony is that the very diverse range of views that have been represented in the national security team undermines the notion of insularity he writes about,” one senior administration official said, requesting anonymity to speak about the internal process.

The official added: “You never know what somebody is going to say when they leave the administration. But I can tell you that no one who has left a national security meeting in this White House has felt that the meeting went exactly their way.”

“The importance of the process isn’t that someone’s opinion is adopted but that it is heard,” the official said. “And if there’s one thing that can be said about the Afghan review process, it’s that everyone was heard.”

Welcome dissent

On taking office as a still-recovering academic, Obama liked the idea of big personalities debating policy, edgy internal colloquies that required the preparation of the Harvard Law School seminars he once attended. He was comfortable with his own intellect, advisers said, and invited dissent in morning everyone-in-the-room-gets-to-speak policy sessions.

There were also political calculations in the selections.

In choosing Hillary Rodham Clinton as secretary of state, for example, Obama brought his chief political rival inside, keeping potentially damaging criticism and buyer’s remorse from the Democratic base to a minimum.

Obama did something similar in picking Joe Biden, another primary rival, as his running mate. Biden brought to the White House a warm populism not often seen in the former constitutional-law lecturer in the Oval Office.

And then there was Gates, who presented Obama with a risk-reward decision full of political implications.

Gates was an esteemed Republican at a time when Obama and his senior advisers were looking to give the new administration a bipartisan cast in line with his presidential campaign’s bridge-building pledges.

Gates had vast experience running the government’s largest and most politically complex national security institutions, including the CIA and the Pentagon.

And, as Obama has noted, he and Gates seemed to think through problems in much the same way. Gates acknowledges as much in his book, praising Obama, and by proxy himself, as “very thoughtful and analytical, but he is also quite decisive.”

“I think,” Gates added, “we have a similar approach to dealing with national security issues.”

But some of those same attributes also made Gates a question mark for Obama’s core political supporters, who were looking for a clean break from the Bush administration’s war policies and anyone identified with them. It was a risk Obama was willing to take as he undertook a comprehensive review and revamping of the way the country would fight and leave the war in Afghanistan.

A White House statement responding to the book said Obama “welcomes differences of view among his national security team.”

But he has already turned away from the “team of rivals” approach. No longer a new president short on executive experience, Obama now prefers like-minded loyalists capable of pushing in the direction he has decided to go.

Take his war cabinet. In his second term, Obama selected former senator Chuck Hagel (R-Neb.) to head the Pentagon and Sen. John F. Kerry (D-Mass.) to replace Clinton at the State Department.

Both men served with Obama — and with Biden — on the Senate Foreign Relations Committee, and both share with Obama, far more profoundly than Gates or Clinton ever did, a sense that the United States must play a more modest role abroad at a time of economic uncertainty at home.

There is another former member of Obama’s “team of rivals” with some decisions ahead on how to talk about her former employer: Clinton.

As she ponders a 2016 presidential run, the former top diplomat, whom Gates describes as “ideological but pragmatic,” will be asked to talk about administration policies and decision-making during her tenure. The temptation to distance herself from the less successful ones, whether concerning the Arab Spring, Afghanistan or Israel, will be great.

Clinton, whom Obama has celebrated as one of the nation’s best secretaries of state, will soon have her first big opportunity to speak out: Her memoir is scheduled for release in June.