Boston, Massachusetts (CNN) -

The president's campaign visit to Durham, N.H., on Monday was almost derailed due to the substantial cost that a town must incur to beef up security in accordance with US Secret Service demands.

When the Obama campaign informed Durham officials on Thursday morning that it had been selected as the site for the president's rally on Monday, Town Administrator Todd Selig sent a formal request on behalf of the Durham Town Council that the campaign reimburse the town for any security-related costs incurred during the president's visit.

"In this case our position was that we should make the request because it was a campaign related event," Selig said. "Ultimately, the campaign declined the town's request."

The campaign's response came in the form of a letter from Obama for America Chief Operating Officer Ann Marie Habershaw sent on Saturday.

"As a private organization, OFA does not participate in security or traffic control planning," Habershaw wrote. "All such decisions, including their impact on costs incurred by federal, sate or local governments, are exclusively within the control of the appropriate government officials. Should there be a question about the allocation of expenses among cooperating authorities, we assume it should be directed to the U.S. Secret Service."

But just one day before the president's scheduled arrival, the conflict over who would pay the overtime costs for Durham police and firefighters was averted when an anonymous Durham resident stepped forward and offered to reimburse the town up to $20,000 in order to allow the president's campaign rally to go on as scheduled.

According to Selig, the donation was made not out of partisan loyalty, but to allow Durham the "privilege" of hosting a sitting president.

"The donor wanted us to make public his/her sentiment that our Town had done the right thing in asking the campaign to do its part," Selig said.

If Obama was visiting Durham in his official capacity as president, Selig said that the security-related costs would likely have been a non-issue, but as a town "struggling to save money in tough economic times" the town council felt it appropriate to request reimbursement for helping to provide security for a campaign visit.

Not being sure exactly how long the president would stay in town or exactly where he would travel during his visit, Selig initially estimated the cost of paying overtime for Durham police and firefighters at between $20,000 and $30,000. But after the event, Selig lowered that estimate to $16,500 for police and $3,100 for fire support, although the exact costs are as yet unknown.

In an open letter, Durham Town Council Chair Jay Gooze and Chair Pro-Tem James Lawson explained their rationale for making the request.

"We want to be clear that our town's request was not motivated by partisan politics (a majority of Durham voters are registered Democrats) or by a want to make a national statement about campaign reimbursements," Gooze and Lawson wrote. "We have more than enough civic work on our plate. To be clear, our request came from the basic responsibility that a local government has to its residents to ensure that expenses outside our approved budget are recovered in a fair and equitable manner."

The council's request is not without precedent. In the 11 years that Selig has been the town administrator in Durham, he has not faced a situation exactly like this one -- where a sitting president planned to visit his town solely for the benefit of his campaign. But police officials informed Selig that when George W. Bush visited Durham prior to his election in 2000 the town requested similar reimbursement and the Bush campaign agreed.