During the dark days that began Timothy F. Geithner’s tenure as Treasury secretary, he was constantly under fire, accused of bailing out Wall Street instead of helping ordinary Americans. With lawmakers from both parties calling for him to resign, it was an open question whether he’d last the year.

Geithner recounted for colleagues what his teenage daughter told him: If you were in Iraq, people would at least understand you were trying to help the country.

Geithner has not only survived but quietly gained influence, which he has used to press President Obama to curb the nation’s soaring debt even at the expense of spending that might more directly spur employment.

His success at driving the agenda signals his status as the president’s closest economic counselor. With the departure this summer of Austan Goolsbee as chairman of the Council of Economic Advisers, Geithner will be the last remaining member of the president’s original economic team and, with Federal Reserve Chairman Ben S. Bernanke, one of the two remaining architects of the great banking bailout that began in 2008, even before Obama’s election.

Geithner, who was once a registered Republican and then an independent, has a faith in the marketplace that puts him at odds with many of Obama’s traditional Democratic allies, whose skepticism about markets seemed vindicated by the financial crisis. His debut on Obama’s team was also shaky. He faced questions about whether he had properly paid all his taxes, and his initial public defense of the administration’s plan for rescuing the financial industry was uninspired, prompting anxiety in the markets.

But over the past year, he has fared better, especially at pushing his viewpoint in internal White House debates. While forces outside the White House — in particular, Republican lawmakers — have helped turn Washington’s attention to the nation’s debt, Geithner’s efforts inside the White House have shaped how Obama confronts this defining moment. At stake in the months ahead are the size of government, the generosity of the nation’s safety net, the taxes people will pay and the debt that will weigh on future generations.

The policies molded by Geithner — and the balance they strike between slashing the deficit and supporting the economic recovery — could also ultimately determine whether Obama will win a second term.

Geithner has successfully pressed Obama to announce a plan to reduce the deficit by $4 trillion, though the president ultimately proposed doing it in 12 years rather than 10, as the Treasury secretary wanted. And Geithner has argued for an approach that would include tax increases, spending cuts and politically explosive changes to government retiree programs like Social Security and Medicare.

“He pushes the envelope,” William Daley, Obama’s chief of staff, said in an interview. “The debate has a political piece that brings us back a little from what Tim may be advocating.”

Even with Geithner in favor of deficit reduction, Republicans accuse the administration of not going far enough. Urging deep cuts in federal spending, GOP lawmakers are threatening to oppose an increase in the federal debt limit, inviting what Geithner warns would be a devastating default by the government.

In a letter to Geithner last month, 17 Republican senators warned of profligate spending by the government and faulted him for scare-mongering in pressing Congress to lift the debt limit. “We believe it is irresponsible and harmful for you to sow the seeds of doubt in the market regarding the full faith and credit of the United States,” the senators wrote.

Some Democrats, meanwhile, are criticizing the administration for focusing on the deficit at the expense of creating more jobs.

Geithner says Obama must tackle the deficit now if he wants the government to be in a position to support the economy in the future and to continue to protect the elderly and the poor.

“It’s been my view for some time that unless he played a major role in shaping and negotiating the broad fiscal framework . . . we would be left without the capacity to do a whole range of things that are really important,” Geithner, 49, said in an interview. “I have been a consistent advocate of him doing that early and often.”

Stimulus vs. deficit

In the summer of 2009, Geithner was asked by a television interviewer whether tax hikes would be needed to rein in the nation’s debt. Geithner responded it was too early to tell, an early hint of the priority he put on cutting the deficit.

Political strategists at the White House were mortified. Obama had promised not to raise taxes on the middle class. This had been a centerpiece of his election campaign. At a White House briefing a day after Geithner’s remarks, he was publicly chided by Obama’s top spokesman for engaging in a “hypothetical.”

But Geithner already had the president’s ear. Privately, Obama offered reassurance. “I’d have said the same thing,” Obama told him, according to two people familiar with the conversation.

By early last year, Geithner was beginning to gain the upper hand in a rancorous debate over whether to propose a second economic stimulus program to Congress, beyond the $787 billion package lawmakers had approved in 2009.

Lawrence Summers, then the director of the National Economic Council, and Christina Romer, then the chairwoman of the Council of Economic Advisers, argued that Obama should focus on bringing down the stubbornly high unemployment rate. This was not the time to concentrate on deficits, they said.

Peter Orszag, Obama’s budget director, wanted the president to start proposing ways to bring spending in line with tax revenue.

Although Geithner was not as outspoken, he agreed with Orszag on the need to begin reining in the debt, according to current and former administration officials. Some spoke for this article on the condition of anonymity to discuss internal deliberations.

Even before the president had been inaugurated, Geithner had been urging him to set a target for the budget deficit that would require shrinking its size to 3 percent of the U.S. economy. At that level, the national debt would eventually become manageable.

“From the earliest moments of the administration and even before, he clearly had a big focus on long-term deficit reduction and making clear, not just to the markets but for the entire economy, that the government is living within its means,” Goolsbee said in an interview.

The economic team went round and round. Geithner would hold his views close, but occasionally he would get frustrated. Once, as Romer pressed for more stimulus spending, Geithner snapped. Stimulus, he told Romer, was “sugar,” and its effect was fleeting. The administration, he urged, needed to focus on long-term economic growth, and the first step was reining in the debt.

Wrong, Romer snapped back. Stimulus is an “antibiotic” for a sick economy, she told Geithner. “It’s not giving a child a lollipop.”

In the end, Obama signed into law only a relatively modest $13 billion jobs program, much less than what was favored by Romer and many other economists in the administration.

“There was this move to exit fiscal stimulus a lot sooner than we should have, and we’ve been playing catch-up ever since,” Romer said in an interview.

Some of Obama’s Democratic allies felt let down. Andrew Stern, former president of the Service Employees International Union, said in an interview that Geithner looks at the world “from his experience, which is predominantly a Wall Street, Treasury, fiscal and monetary policy point of view.”

‘Plan beats no plan’

Even as Geithner stumbled in his first months, Obama stood by him. And they grew closer, their relationship nurtured by daily meetings and occasional basketball games. “They don’t get worked up when things are going wrong. They don’t get worked up if things are going well,” a senior White House official said.

By the middle of last year, Geithner’s fortunes had shifted. Even the gargantuan bailout of American International Group by the federal government wasn’t looking so bad anymore. Last summer, Jim Millstein, an investment banker assigned to oversee Treasury’s rescue of AIG, walked into Geithner’s office with good news: Taxpayers were going to get their investment in AIG back, and maybe a profit.

“Get the [expletive] out,” Geithner responded. “I haven’t had any good news on AIG.”

In reality, this was one in a series of successes Geithner was enjoying. Banks were paying back hundreds of billions of bailout dollars to the government. Ambitious legislation to overhaul financial regulation had finally passed Congress. The financial system was on the mend.

And Geithner’s influence with the president was growing on a wide range of issues, including sanctions on Middle East regimes and policy toward China.

Buoyed by his successes, Geithner felt ready to fire the administration’s first salvos in the debt war last summer.

Republicans were pushing for an extension of tax cuts for the wealthy enacted during George W. Bush’s presidency. It was administration policy to oppose extending them, but neither White House advisers nor congressional Democrats, facing tough midterm elections, wanted to engage in a tax fight.

Geithner, however, believed the tax cuts were a waste of money at a time of growing deficits and began giving speeches about the importance of letting them expire. When the Republicans won the midterm elections, Obama negotiated a deal with GOP leaders to extend the tax cuts in exchange for other measures that would stimulate the economy.

Though Geithner agreed with the deal, he was deeply concerned that the government had not yet taken substantial steps to reduce the debt. In part, he worried about whether the government would have enough money to invest in long-term economic growth or pay for programs like Medicare and Social Security.

“Unless you put in a place a long-term fiscal framework, you’re not going to be able to defend a level of entitlement benefits that this president would like to be able to support,” Geithner said.

By the start of the year, the economic team had closed ranks around the need for deficit reduction. Gone were Summers, Orszag and Romer. Gene B. Sperling, a Geithner counselor, took over as head of the National Economic Council, and Jacob J. Lew was named budget director. Both had helped turn deficits into surpluses while working in the Clinton administration. Goolsbee became chairman of the Council of Economic Advisers.

Yet there were still divides. Obama’s advisers now disagreed about when the president should roll out a deficit reduction plan and how far it should go. Geithner pushed Obama to “lean forward,” according to several participants, cutting the deficit as much as possible as fast as possible. “Plan beats no plan,” Geithner would say, a phrase he has used in situations ranging from the financial crisis to cutting of the funding of terrorists.

Putting priority on deficit

By contrast, the president’s political advisers thought the president should go slow. They wanted to see what a bipartisan group of senators who were negotiating over the deficit would recommend and wait until Republicans unveiled their own plan.

“Tim was one of those advocating not to wait. You can’t wait. Do something in the State of the Union,” said Daley, the White House chief of staff. But Obama did wait, only briefly mentioning deficit reduction in the address.

Geithner also wanted to work out details of overhauling Medicare and Social Security and urged that the administration propose reducing the deficit by $4 trillion over 10 years.

Other advisers questioned whether that much in deficit reduction was necessary. Aides asked: Would it require too many cuts? Might the economy recover faster, lessening the need for cuts?

By April, Geithner had gotten Obama to sign on to $4 trillion in deficit reduction, but not quite as fast as the Treasury secretary hoped. Obama’s advisers thought it would take too many cuts in government spending — or compromise the president’s pledge to maintain middle-class tax cuts — to achieve the reductions in 10 years. They decided they would announce a framework to chop $4 trillion over 12 years.

Republicans wanted much more. They are now threatening to block an increase in the debt ceiling, leveraging the prospect of a government default in hopes of forcing deeper spending cuts.

Last week, a day after Obama received Republican lawmakers at the White House, Geithner met with Republican freshmen to make the administration’s case. Many were unconvinced.

“After meeting with both President Obama and Treasury Secretary Geithner this week, I and my colleagues are not confident that the Administration has a credible plan to reduce our debt, so it’s time to demand one,” freshman Rep. Diane Black (R-Tenn.) said in a statement. “Clearly a package of significant spending cuts and structural reforms are necessary.”

Geithner has assured lawmakers that the administration recognizes the dangers posed by mounting debt, including possible erosion of investor confidence in the United States, and is taking deficit reduction seriously.

“Because of his experience managing the financial crisis, he brings enormous credibility on market confidence,” Sperling said. “When he warns there is true risk to the economy, he is seen as being almost above politics, and that helps focus people on the task at hand.”