Hillary Clinton sat in the hideaway study off her ceremonial office in the State Department, sipping tea and taking stock of her first year on the job.

The study was more like a den — cozy and wood-panelled, lined with bookshelves that displayed mementos from Clinton’s three decades in the public eye: a statue of her heroine, Eleanor Roosevelt; a baseball signed by the Chicago Cubs star Ernie Banks; a carved wooden figure of a pregnant African woman.

The intimate setting lent itself to a less-formal interview than the usual locale, her imposing outer office, with its marble fireplace, heavy drapes, crystal chandelier and ornate wall sconces. On the morning of February 26, 2010, however, Clinton was talking about something more sensitive than mere foreign affairs: her relationship with Barack Obama.

To say she chose her words carefully doesn’t do justice to the delicacy of the exercise. She was like a bomb-squad technician, deciding which colour wire to snip without blowing up her relationship with the White House.

‘‘We’ve developed, I think, a very good rapport, really positive back-and-forth about everything you can imagine,’’ Clinton said about the man she described during the 2008 campaign as naïve, irresponsible and hopelessly unprepared to be president. ‘‘And we’ve had some interesting and even unusual experiences along the way.’’ She leaned forward as she spoke, gesturing with her hands and laughing easily. In talking with reporters, Clinton displays more warmth than Obama does, though there’s less of an expectation that she might say something revealing.

Secretary of State Hillary Clinton listens attentively as US President and Barack Obama makes a point. She and Obama split on bedrock issues of war and peace. Picture: Getty

Clinton singled out, as she often would, the United Nations climate-change meeting in Copenhagen the previous December, where she and Obama worked together to save the meeting from collapse. She brought up the Middle East peace process, a signature project of the president’s, which she had been tasked with reviving.

But she was understandably wary of talking about areas in which she and Obama split — namely, on bedrock issues of war and peace, where Clinton’s more activist philosophy had already collided in unpredictable ways with her boss’s instincts toward restraint. She had backed General Stanley McChrystal’s recommendation to send 40,000 more troops to Afghanistan, before endorsing a fallback proposal of 30,000 (Obama went along with that, though he stipulated that the soldiers would begin to pull out again in July 2011, which she viewed as problematic).

She supported the Pentagon’s plan to leave behind a residual force of 10,000 to 20,000 American troops in Iraq (Obama balked at this, largely because of his inability to win legal protections from the Iraqis, a failure that was to haunt him when the Islamic State overran much of the country). And she pressed for the United States to funnel arms to the rebels in Syria’s civil war (an idea Obama initially rebuffed before later, halfheartedly, coming around to it).

That fundamental tension between Clinton and the US president would continue to be a defining feature of her four-year tenure as secretary of state. In the administration’s first high-level meeting on Russia in February 2009, aides to Obama proposed that the United States make some symbolic concessions to Russia as a gesture of its good will in resetting the relationship.

Clinton, the last to speak, brusquely rejected the idea, saying, ‘‘I’m not giving up anything for nothing.’’ Her hardheadedness made an impression on Robert Gates, the US defence secretary and George W. Bush holdover who was wary of a changed Russia. He decided there and then that she was someone he could do business with.

‘‘I thought, this is a tough lady,” he told me. A few months after my interview in her office, another split emerged when Obama picked up a secure phone for a weekend conference call with Clinton, Gates and a handful of other advisers.

It was July 2010, four months after the North Korean military torpedoed a South Korean Navy corvette, sinking it and killing 46 sailors. Now, after weeks of fierce debate between the Pentagon and the State Department, the United States was gearing up to respond to this brazen provocation.

The Pentagon

The tentative plan — developed by Clinton’s deputy at State, James Steinberg — was to dispatch the aircraft carrier George Washington into coastal waters to the east of North Korea as an unusual show of force.

But Adm. Robert Willard, then the Pacific commander, wanted to send the carrier on a more aggressive course, into the Yellow Sea, between North Korea and China. The Chinese foreign ministry had warned the United States against the move, which for Willard was all the more reason to press forward.

He pushed the chairman of the Joint Chiefs of Staff , Mike Mullen, who in turn pushed his boss, the defence secretary, to reroute the George Washington. Gates agreed, but he needed the commander in chief to sign off on a decision that could have political as well as military repercussions.

Gates laid out the case for diverting the George Washington to the Yellow Sea: that the United States should not look as if it was yielding to China. Clinton strongly seconded it. ‘‘We’ve got to run it up the gut!’’ she had said to her aides a few days earlier.

Obama, though, was not persuaded. The George Washington was already underway; changing its course was not a decision to make on the fly.

It wasn’t the last debate in which she would side with Gates. The two quickly discovered that they shared a Midwestern upbringing, a taste for a stiff drink after a long day of work and a deep-seated skepticism about the intentions of America’s foes.

Bruce Riedel, a former intelligence analyst who conducted Obama’s initial review on the Afghanistan war, says: ‘‘I think one of the surprises for Gates and the military was, here they come in expecting a very left-of-centre administration, and they discover that they have a secretary of state who’s a little bit right of them on these issues — a little more eager than they are, to a certain extent. Particularly on Afghanistan, where I think Gates knew more had to be done, knew more troops needed to be sent in, but had a lot of doubts about whether it would work.’’

As Hillary Clinton makes another run for president, it can be tempting to view her hard-edged rhetoric about the world less as deeply felt core principle than as calculated political manoeuvre.

But Clinton’s foreign-policy instincts are bred in the bone — grounded in cold realism about human nature and what one aide calls ‘‘a textbook view of American exceptionalism.’’ It set her apart from her rival-turned-boss, Barack Obama, who avoided military entanglements and tried to reconcile Americans to a world in which the United States was no longer the undisputed hegemon.

And it will likely set her apart from the Republican candidate she meets in the general election. For all their bluster about bombing the Islamic State into oblivion, neither Donald J Trump nor Senator Ted Cruz of Texas have demonstrated anywhere near the appetite for military engagement abroad that Clinton has.

‘‘Hillary is very much a member of the traditional American foreign-policy establishment,’’ says Vali Nasr, a foreign-policy strategist who advised her on Pakistan and Afghanistan at the State Department. ‘‘She believes, like presidents going back to the Reagan or Kennedy years, in the importance of the military — in solving terrorism, in asserting American influence.

The shift with Obama is that he went from reliance on the military to the intelligence agencies. Their position was, ‘All you need to deal with terrorism is N.S.A. and C.I.A., drones and special ops.’ So the C.I.A. gave Obama an angle, if you will, to be simultaneously hawkish and shun using the military.’’ Unlike other recent presidents — Obama, George W Bush or her husband, Bill Clinton — Hillary Clinton would assume the office with a long record on national security.

There are many ways to examine that record, but one of the most revealing is to explore her decades-long cultivation of the military — not just civilian leaders like Gates, but also its high-ranking commanders, the men with the medals.

Her affinity for the armed forces is rooted in a lifelong belief that the calculated use of military power is vital to defending national interests, that American intervention does more good than harm and that the writ of the United States properly reaches, as Bush once put it, into ‘‘any dark corner of the world.’’ Unexpectedly, in the bombastic, testosterone-fuelled presidential election of 2016, Hillary Clinton is the last true hawk left in the race.

For those who know Clinton’s biography, her embrace of the military should come as no surprise. She grew up in the buoyant aftermath of World War II, the daughter of a Navy petty officer who trained young sailors before they shipped out to the Pacific.

Her father, Hugh Rodham, was a staunch Republican and an anti-communist, and she channelled his views. She talks often about her girlhood dream of becoming an astronaut, citing the rejection letter she got from NASA as the first time she encountered gender discrimination. Her real motive for volunteering, she has written, may have been because her father fretted that ‘‘America was lagging behind Russia.’’

Political conversion came later, after Vietnam and the ’60s swept over Wellesley College, where she spoke out against the establishment at her graduation. But even in the tumultuous year of 1968, she was still making her transition from Republican to Democrat, managing to go to the conventions of both parties. As a Republican intern in Washington that summer, she questioned a Wisconsin congressman, Melvin Laird, about the wisdom of Lyndon B Johnson’s escalating involvement in Southeast Asia.

It was after law school that she had her most curious encounter with the military. In 1975, the year she married Bill Clinton, she stopped in at a Marine recruiting office in Arkansas to inquire about joining the active forces or reserves. She was a lawyer, she explained; maybe there was some way she could serve.

Bill and Hillary Clinton

The recruiter, she recalled two decades later, was a young man of about 21, in prime physical condition. Clinton was then 27, freshly transplanted from Washington, teaching law at the University of Arkansas in Fayetteville and wearing Coke-bottle eyeglasses. ‘‘You’re too old, you can’t see and you’re a woman,’’ he told her.

‘‘Maybe the dogs will take you,’’ he added, in what she said was a pejorative reference to the Army.

‘‘It was not a very encouraging conversation,’’ Clinton said at a lunch for military women on Capitol Hill in 1994. ‘‘I decided, maybe I’ll look for another way to serve my country.’’ Some reporters have cast doubt on the veracity of this story, which she repeated in the Autumn of 2015 over breakfast with voters in New Hampshire: certainly, there’s no concrete evidence that it happened, and Bill gave a different account of it in 2008, substituting the Army for the Marines.

Clinton’s next sustained exposure to the military did not come until she was first lady, almost two decades later. Living in the White House is, in many ways, like living in a military compound. A Marine stands guard in front of the West Wing when the president is in the Oval Office. The Military Office operates the medical centre and the telecommunications system.

The White House

The Navy runs the cafeteria, the Marines transport the president by helicopter, the Air Force by plane. Camp David is a naval facility. The daily contact with men and women in uniform, Clinton’s friends say, deepened her feelings for them.

In March 1996, the first lady visited American troops stationed in Bosnia. The trip became notorious years later when she claimed, during the 2008 campaign, to have dodged sniper fire after her C-17 military plane landed at an American base in Tuzla. (Chris Hill, a diplomat who was onboard that day and later served as ambassador to Iraq under Clinton, didn’t remember snipers at all, and indeed recalled children handing her bouquets of spring flowers.)

But there was no faking the good vibes during her tour of the mess and rechalls. With her teenage daughter at her side, she bantered and joked with the young servicemen and women — an experience, she wrote, that ‘‘left lasting impressions on Chelsea and me.’’ When Clinton was elected to the Senate, she had strong political reasons to care about the military.

The Pentagon was in the midst of a long, politically charged process of closing military bases; New York State had already been a victim, when Plattsburgh Air Force Base was closed in 1995, a loss of 352 civilian jobs for that hardluck North Country town.

New York’s delegation was determined to protect its remaining bases, especially Fort Drum, home of the Army’s 10th Mountain Division, which sprawls over 100,000 acres in rural Jefferson County. In October 2001, a month after the 9/11 terrorist attacks, Clinton travelled to Fort Drum at the invitation of Gen Buster Hagenbeck, who had just been named the division’s commander and would be deployed to Afghanistan a month later. Like many of the officers I spoke with, he had preconceptions of Clinton from her years as first lady; the woman who showed up at his office around happy hour that afternoon did not fulfill them.

‘‘She sat down,’’ he recalls, ‘‘took her shoes off , put her feet up on the coffee table and said, ‘General, do you know where a gal can get a cold beer around here?’ ’’ It was the start of a dialogue that stretched over two wars. In the spring of 2002, Hagenbeck led Operation Anaconda, a 16-day assault on Taliban and Al Qaeda fighters in the Shah-i-Kot Valley that was the largest combat engagement of the war to-date. When the general came back to Washington to brief the Joint Chiefs of Staff, Clinton took him out to dinner on Capitol Hill for her own briefing.

They also spoke about the Bush administration’s preparations for war in Iraq, something which Hagenbeck was following anxiously. The general, it turned out, was more of a dove than the senator. He warned her about the risks of an invasion, which was then being war-gamed inside the Pentagon. It would be like ‘‘kicking over a bee’s nest,’’ he said.

Hagenbeck excused Clinton’s vote in 2002 to authorise military action in Iraq. ‘‘She made a considered call,’’ he says. And ‘‘she was chagrined, much after the fact.’’ For him, what mattered more than Clinton’s voting record was her unstinting public support of the military, whether in protecting Fort Drum or backing him during a difficult first year in Afghanistan.

Clinton’s education in military affairs began in earnest in 2002, after the Democratic Party’s crushing defeat in midterm elections moved her up several rungs in Senate seniority. The party’s congressional leaders offered her a seat on either the Senate Foreign Relations Committee or the Senate Armed Services Committee. She chose Armed Services, spurning a long tradition of New York senators, like Daniel Patrick Moynihan and Jacob Javits, who coveted the prestige of Foreign Relations.

Armed Services deals with more earth-bound issues, like benefits for veterans, and it had long been the preserve of Republican hawks like John McCain. But after 9/11, Clinton saw Armed Services as better preparation for her future. For a politician looking to hone hard-power credentials — a woman who aspired to be commander in chief — it was the perfect training ground. She dug in like a grunt at boot camp.

Andrew Shapiro, then Senator Clinton’s foreign-policy adviser, called upon 10 experts — including Bill Perry, who was defence secretary under her husband, and Ashton Carter, who would eventually become President Obama’s fourth defence secretary — to tutor her on everything from grand strategy to defensce procurement.

She met quietly with Andrew Marshall, an octogenarian strategist at the Pentagon who laboured for decades in the blandly named Office of Net Assessment, earning the nickname Yoda for his Delphic insights. She went to every committee meeting, no matter how mundane. Aides recall her on C-SPAN3, sitting alone in the chamber, patiently questioning a lieutenant colonel.

She visited the troops in Afghanistan on Thanksgiving Day in 2003 and spoke at every significant military installation in New York State. By then — 30 years after she recalled being rejected by a Marine recruiter in Arkansas — Hillary Clinton had become a military wonk.

Hillary Clinton meets US troops in Afghanistan when Secretary of State. Her affinity for the armed forces is rooted in a lifelong belief that the calculated use of military power is vital to defending national interests.

Jack Keane is one of the intellectual architects of the Iraq surge; he is also perhaps the greatest single influence on the way Hillary Clinton thinks about military issues. A bear of a man with a jowly, careworn face and Brylcreem-slicked hair, Keane exudes the supreme self-confidence you would expect of a retired four-star general.

He speaks with a trace of a New York accent that gives his pronouncements a rat-a-tat urgency.

He is also a well-compensated member of the military-industrial complex, sitting on the board of General Dynamics and serving as a strategic adviser to Academi, the private-security contractor once known as Blackwater.

And he is the chairman of an aptly named think tank, the Institute for the Study of War. Though he is one of a parade of cable-TV generals, Keane is the resident hawk on Fox News, where he appears regularly to call for the United States to use greater military force in Iraq, Syria and Afghanistan. He doesn’t shrink from putting boots on the ground and has little use for civilian leaders, like Obama, who do.

Keane first got to know Clinton in the Autumn of 2001, when she was a freshman senator and he was the Army’s second in command, with a distinguished combat and command record in Vietnam, Somalia, Haiti, Bosnia and Kosovo.

He had expected her to be intelligent, hard-working and politically astute, but he was not prepared for the respect she showed for the Army as an institution, or her sympathy for the sacrifices made by soldiers and their families. Keane was confident he could smell a phony politician a mile away, and he didn’t get that whiff from her.

‘‘I read people; that’s one of my strengths,’’ he told me. ‘‘It’s not that I can’t be fooled, but I’m not fooled often.’’ Clinton took an instant liking to Keane, too. ‘‘She loves that Irish gruff thing,’’ says one of her Senate aides, Kris Balderston, who was in the room that day. When Keane got up after 45 minutes to leave for a meeting back at the Pentagon with a Polish general, she protested that she wasn’t finished yet and asked for another appointment. ‘‘I said, ‘OK, but it took me three months to get this one,’ ’’ Keane told her dryly.

Clinton exploded into a raucous laugh. ‘‘I’ll take care of that problem,’’ she promised.

She was true to her word: The two would meet many times over the next decade, discussing the wars in Afghanistan and Iraq, the Iranian nuclear threat and other flash points in the Middle East.

Sometimes he dropped by her Senate office; other times they met for dinner or drinks. He escorted her on her first visit to Fort Drum and set up her first trip to Iraq. They generally agreed to forgo talk of politics, but at a meeting in Clinton’s Senate office in January 2007, Keane tried to sell her on the logic of a troop surge in Iraq.

The previous month, he had met with President Bush in the Oval Office to recommend that the United States deploy five to eight Army and Marine brigades to wage an urban counterinsurgency campaign; only that, he argued, would stabilise a country being ripped apart by sectarian strife. His presentation angered some of Keane’s fellow generals, who feared that such a strategy would deepen Iraq’s dependency and prolong America’s involvement.

But it had a big impact on the commander in chief, who soon ordered more than 20,000 additional troops to Iraq.

US jest in Iraq in 2014.

Politics, of course, was also on her mind. Barack Obama was laying the groundwork for his candidacy in mid-January with a campaign that would emphasise his opposition to the Iraq War and her vote in favour of it — a vote that still shadows her in this year’s Democratic primaries.

Obama was setting off on a fund-raising drive that would net $25 million in three months, sending tremors through Clinton’s political camp and establishing him as a formidable rival. Although she disagreed with Keane about Iraq, Clinton asked him to become a formal adviser. ‘‘As much as I respect you,’’ he replied, ‘‘I can’t do that.’’

Keane’s wife had health problems that had moved up his retirement from the Army, and he did not, as a policy, endorse candidates. Sometime during 2008 — he doesn’t remember exactly when — Clinton told him she had erred in doubting the wisdom of the surge.

‘‘She said, ‘You were right, this really did work,’ ’’ Keane recalls. ‘‘On issues of national security,’’ he says, ‘‘I thought she was always intellectually honest with me.’’ He and Clinton continued to talk, even after Obama was elected and she became secretary of state. More often than not, they found themselves in sync. Keane, like Clinton, favoured more robust intervention in Syria than Obama did.

In April 2015, the week before she announced her candidacy, Clinton asked him for a briefing on military options for dealing with the fighters of the Islamic State. Bringing along three young female analysts from the Institute for the Study of War, Keane gave her a 2-hour-20-minute presentation.

Among other steps, he advocated imposing a no-fly zone over parts of Syria that would neutralise the air power of the Syrian president, Bashar al-Assad, with a goal of forcing him into a political settlement with opposition groups.

Six months later, Clinton publicly adopted this position, further distancing herself from Obama.

Befriending Keane wasn’t just about cultivating a single adviser. It gave Clinton instant entree to his informal network of active-duty and retired generals. The most interesting by far was David Petraeus, a cerebral commander who shared Clinton’s jet-fuelled ambition and whose life stories would mix heady success with humbling setbacks.

Both would be accused of mishandling classified information — Clinton because of her use of a private server and email address to conduct sensitive government business, a decision that erupted into a political scandal; Petraeus because he had given a diary containing classified information to his biographer and mistress (he was eventually charged with a misdemeanour for mishandling classified information).

Clinton’s fixation with maps was typical of her mind-set in the first great war-and-peace debate of the Obama presidency. She wanted to be taken seriously, even if her department was less central than the Pentagon.

One way to do that was by promoting the civilian surge, the pet project of her friend and special envoy to the region, Richard Holbrooke. ‘‘She was determined that her briefing books would be just as thick and just as meticulous as those of the Pentagon,’’ a senior adviser recalls.

She also didn’t hesitate to get into the Pentagon’s business, asking detailed questions about the training of Afghan troops and wading into the weeds of military planning.

She resolved not to miss out on anything — a determination that may have been rooted in a deeper insecurity about her role in what was to become the most White House-centric administration of the modern era.

‘‘There’s no doubt that Hillary Clinton’s more muscular brand of American foreign policy is better matched to 2016 than it was to 2008,’’ said Jake Sullivan, her top policy adviser at the State Department, who plays the same role in her campaign.

It was December 2015, 53 days before the Iowa caucuses, and Sullivan was sitting down with me in Clinton’s sprawling Brooklyn headquarters to explain how she was shaping her message for a campaign suddenly dominated by concerns about national security.

Clinton’s strategy, he said, was twofold: Explain to voters that she had a clear plan for confronting the threat posed by Islamic terrorism, and expose her Republican opponents as utterly lacking in experience or credibility on national security.

There were good reasons for Clinton to let her inner hawk fly. After the attacks in Paris and San Bernardino, California, Americans’ concern about a major attack on the nation spiked.

A CNN/ORC poll taken after Paris showed that a majority, 53%, favoured sending ground troops to Iraq or Syria, a remarkable shift from the war-weary sentiment that prevailed during most of Obama’s presidency.

The Republican candidates were reaching for apocalyptic metaphors to demonstrate their resolve. Ted Cruz threatened to carpet-bomb the Islamic State to test whether desert sand can glow; Donald Trump called for the United States to ban all Muslims from entering the country ‘‘until we are able to determine and understand this problem and the dangerous threat it poses.’’

Donald Trump

Yet such spikes in the public appetite for military action tend to be transitory. Three weeks later, the same poll showed an even split, at 49%, on whether to deploy troops. Neither Trump nor Cruz favours major new deployments of American soldiers to Iraq and Syria (nor, for that matter, does Clinton).

If anything, both are more skeptical than Clinton about intervention and more circumspect than she about maintaining the nation’s post-World War II military commitments. Trump loudly proclaims his opposition to the Iraq War.

He wants the United States to spend less to underwrite NATO and has talked about withdrawing the American security umbrella from Asia, even if that means Japan and South Korea would acquire nuclear weapons to defend themselves.

Cruz, unlike Clinton, opposed aiding the Syrian rebels in 2014. He once supported Pentagon budget constraints advocated by his isolationist colleague, Senator Rand Paul of Kentucky. Thus might the general election present voters with an unfamiliar choice: a Democratic hawk versus a Republican reluctant warrior.

To thwart the progressive insurgency of Senator Bernie Sanders of Vermont, Clinton carefully calibrated her message during the Democratic primaries to align herself closely with Barack Obama and his racially diverse coalition.

Bernie Sanders

But as she pivots to the general election, that balancing act with Obama will become trickier. ‘‘There’s going to be a huge amount of interest in the press to score-keep,’’ Sullivan says. ‘‘It just so easily can become a sport that distracts from her ability to make an affirmative case.’’ In showing her stripes as a prospective commander in chief, Clinton will no doubt draw heavily upon her State Department experience — filtering the lessons she learned in Libya, Syria and Iraq into the sinewy worldview she has held since childhood.

Last Autumn, in a series of policy speeches, Clinton began limning distinctions with the president on national security. She said the United States should consider sending more special-operations troops to Iraq than Obama had committed, to help the Iraqis and Kurds fight the Islamic State. She came out in favour of a partial no-fly zone over Syria. And she described the threat posed by ISIS to Americans in starker terms than he did.

As is often the case with Clinton and Obama, the differences were less about direction than degree. She wasn’t calling for ground troops in the Middle East, any more than he was. Clinton insisted her plan was not a break with his, merely an ‘‘intensification and acceleration’’ of it.

It’s an open question how well Clinton’s hawkish instincts match the America’s mood. Americans are weary of war and remain suspicious of foreign entanglements. And yet, after the retrenchment of the Obama years, there is polling evidence that they are equally dissatisfied with a portrait of their country as a spent force, managing its decline amid a world of rising powers like China, resurgent empires like Vladimir Putin’s Russia and lethal new forces like the Islamic State.

If Obama’s minimalist approach was a necessary reaction to the maximalist style of his predecessor, then perhaps what Americans yearn for is something in between — the kind of steel-belted pragmatism that Clinton has spent a lifetime honing.

‘‘The president has made some tough decisions,’’ says Leon Panetta, who served as Obama’s defence secretary after Bob Gates, and as director of the C.I.A. before David Petraeus. ‘‘But it’s been a mixed record, and the concern is, the president defining what America’s role in the world is in the 21st century hasn’t happened.

‘‘Hopefully, he’ll do it,’’ he added, acknowledging the time Obama has left. ‘‘Certainly, she would.’’