Even as it bragged about beating President Obama in fundraising over the summer, Mitt Romney’s presidential campaign was so low on cash that it ended up engineering an unusual $20 million loan to meet expenses until the former Massachusetts governor was formally named as the Republican nominee in late August, officials disclosed Tuesday.

The loan from the Bank of Georgetown, first reported Tuesday night by National Review Online and confirmed by a senior campaign official, provides a telling glimpse into previously unknown money troubles within the Romney camp over the summer. Romney has relied heavily on wealthy donors but has had persistent difficulty raising money among grassroots donors, who could have helped buoy his finances during the long summer before the Republican convention in Tampa.

The campaign has paid back $9 million of the loan so far, with $11 million remaining on the debt side of the ledger, said the senior campaign official, who was not authorized to publicly discuss the campaign’s finances.

Federal Election Commission reports to be filed Thursday will show a debt of $15 million, which was the amount outstanding on Aug. 31, according to the campaign. Romney, who loaned more than $40 million of his fortune to his 2008 bid, has not given his 2012 campaign any loans, officials said.

News of the debt comes at an inopportune time for a campaign reeling to right itself after a series of self-inflicted wounds, including controversial criticism of Obama’s handling of attacks on U.S. diplomats overseas and a damaging videotape of Romney describing 47 percent of the country as victims who are dependent on government. The problems have overshadowed a tightening of the race in some recent polls, and have prompted widespread hand-wringing in GOP circles over Romney’s chances.

Explore the candidates’ campaign finances

Candidates for the White House and other major offices commonly borrow money to get through tough times, but the Romney campaign had not previously disclosed that it was among that group. In 2008, Sen. John McCain (R-Ariz.) borrowed money during the primary season and paid it back with a portion of public matching funds that he accepted in exchange for limiting his fundraising.

Neither Obama nor Romney is participating in public financing this year, however, which apparently left the Romney campaign in a pickle: They were running dangerously low on primary funds, but were not allowed to tap a cache of general election money that it began accumulating in late spring. The campaign came up with a variation on the approach used by McCain: Getting a bank to agree to loan $20 million with unused general election funds as collateral, according to the NRO account.

“We took advantage of the law as it exists to secure this line of credit,” an aide told the conservative Web site. “We were able to stay competitive in a period when we were looking at a tilted playing field.” 

Although he could legally settle the debt with general election funds, Romney is instead raising separate primary contributions to repay the loan, the senior campaign official said Wednesday. The tactic will allow the campaign to maximize its cash available over the next 50 days and to call upon newer donors to help without hitting contribution limits.

“We are currently undertaking primary debt fundraising to repay the debt,” the official said.

The loan could help explain why the Romney campaign appeared to react timidly this summer to a wave of attack ads from the Obama campaign and a super PAC supporting the president, Priorities USA Action, which aired a series of brutal spots portraying Romney as a heartless corporate raider. Romney left more of the broadcast duties to outside allies who were disjointed in their messaging, and also did relatively little to lay the foundations for a ground operation to match Obama’s.

Romney and the Republican National Committee outraised the vaunted Obama operation for three months running starting in May, leading to widespread worrying among Democrats about the onslaught to come in the fall. But Obama regained the advantage in August, raising $114 million to Romney’s $112 million, according to the campaigns. Romney and the Republicans had a $60 million cash advantage as of July 31; FEC reports due Thursday will provide clues about whether that margin persists. 

Despite the closer contest in recent months, Obama has still raised far more than his competitor overall and, as of the end of July, had amassed a 3-to-1 staffing advantage on the Republicans. Obama also has more money under his direct control in his campaign bank account, allowing him to take advantage of statutory discounts for ad rates.

Romney, by contrast, has more money stashed in accounts held by the Republican Party, which can accept large checks from the wealthy donors that Romney has relied upon. This will give his campaign less flexibility on how to spend the money in the final weeks.