It had all the ingredients: a leading newspaper, a presidential candidate, anonymous sources, shadowy lobbying, a hint of hypocrisy and denials of extramarital romance.

That combustible combination guaranteed that the surfacing of a long-rumored New York Times story about John McCain and a Washington lobbyist, Vicki Iseman, would ignite a fierce controversy, not just about the Arizona senator but about the newspaper’s conduct as well.

Bill Keller, the paper’s executive editor, dismissed a cascade of attacks yesterday accusing the Times of politically motivated sensationalism. “They’re trying to change the subject to us,” Keller said in an interview. McCain’s advisers, he said, are attempting “to use the New York Times as an opportunity to rally the base.

“Critics were hurling conflicting charges yesterday. Some said the story was unsubstantiated and should not have been published. Others complained that the Times should have run it sooner, so that voters in the early Republican primaries could have weighed the allegations.

Those critics accused Keller of sitting on the story until McCain had time to secure the Republican nomination.Keller denied deliberately delaying the story, saying that would have put him in the position of withholding important information from voters. “You can’t let the electoral calendar govern your judgment about when to publish stories,” he said.

Minutes after the Times posted the piece on its Web site Wednesday night, conservative commentators — who had recently been ripping McCain’s White House candidacy — rallied to his side against one of their perennial targets.Why, Bay Buchanan asked on CNN, didn’t the Times run the piece in December, before primary voters went to the polls?

Rush Limbaugh yesterday said the story — which said McCain aides nearly a decade ago feared that the senator was having a romantic relationship with Iseman — is “gossip” that the Times put out “just prior to McCain wrapping up the nomination.” Fox’s Sean Hannity called the article a “disgrace.”Media analysts are divided over the bombshell piece, which relied heavily on unnamed sources.

If the Times couldn’t make the case that McCain and Iseman had an intimate relationship — and both have denied it — was it fair to raise the issue? If a crucial allegation was that McCain aides, in 1999 and 2000, told the senator they were worried that the relationship appeared inappropriate and warned Iseman to stay away from their boss, is that worthy of front-page display? If the relevance rests on McCain having written letters to federal regulators nearly a decade ago that would have benefited Iseman’s telecommunications clients, is that less newsworthy because it was reported at the time?

“This is a story that rests on the suspicions, unproven, of unnamed sources,” said Tom Rosenstiel, director of the Washington-based Project for Excellence in Journalism. “That creates a problem for the New York Times. We’re not in an age of trust-me journalism. . . . What you have is a story that some staffers were worried about something.

Their worries could well be unfounded, and we don’t know that.”But Alex Jones, who runs Harvard’s Shorenstein Center on the Press, Politics & Public Policy, called the story “absolutely appropriate. When you run for president, you should have your record scrutinized closely in every respect.” Jones, a former Times reporter, said the paper demonstrated that McCain and Iseman had “a very close relationship. . . . The only thing that seems to be in dispute is whether it was a romantic relationship, and that, frankly, is the least important part of it.

“The Beltway began buzzing about the Times investigation in December when Matt Drudge reported its existence on his Internet gossip site. The next day, The Washington Post reported that McCain had taken the unusual step of hiring criminal lawyer Robert Bennett to handle the inquiry, and that McCain had called Keller to deny the allegations and complain that he was being treated unfairly.

Although there were disputes within the Times over the story, Keller said he simply waited until it was ready. ” ‘Ready’ means we’ve got the facts nailed down to our satisfaction,” he said. “We’ve given the subjects of the story ample time to respond. The story is written in a way that’s fair and balanced and has all the context and caveats.”The story quoted one on-the-record source, former McCain strategist John Weaver, who said he had arranged a 1999 meeting between a top campaign aide and Iseman at Union Station at which she was asked to stay away from the senator. Weaver left McCain’s campaign last summer during a near-implosion over staffing and fundraising.

The key unnamed sources are described as two former McCain associates, interviewed independently, who “said they had become disillusioned with the senator.” But that information does not appear until the article’s 41st paragraph.“We push very hard to get sources to go on the record,” Keller said. “You can’t always succeed.”

He said the Times has “cracked down” on its use of anonymous informants and tries “to tell you what we can about a source’s motivation and access to information.”The story was the subject of considerable internal debate, going through more than a dozen drafts, say people familiar with the process who did not want to be named discussing private deliberations. They disputed an online report by the New Republic yesterday that Keller held up the piece by asking for more evidence of a romantic involvement.

Instead, they say, Dean Baquet, the paper’s Washington bureau chief and a former investigative reporter, pushed for a harder-edged piece, while Keller ultimately decided on a broader narrative that traced McCain’s career from his involvement in the Keating Five scandal of the late 1980s to his reinvention “as the scourge of special interests, a crusader for stricter ethics and campaign finance rules, a man of honor chastened by a brush with shame.”Marilyn Thompson, one of the four members of the Times’ reporting team, resigned recently and will rejoin The Washington Post, where she was a longtime investigative editor and reporter. Thompson said yesterday that her departure was “not directly related to the story” but that she had received “a very good offer to return to editing at a point where I realized that was a job I would find more agreeable. . . . I’ve been in the business long enough not to leave a job over a single piece of journalism.”The Post, which had been pursuing its own story on McCain’s dealings with Iseman, decided to publish its report in yesterday’s editions after the Times piece appeared online.

The Post story also cited several unnamed sources and also quoted Weaver.Leonard Downie Jr., The Post’s executive editor, said the paper has been pursuing numerous stories about McCain and lobbyists and was aware of the Times inquiry. “We probably wound up talking to similar sources,” he said. As the Times neared publication, Downie added, “some sources were more forthcoming in recent days than they had been previously.”The Post made no mention of McCain’s aides expressing concern about a possible romantic relationship with Iseman nine years ago. “What we published is what we had,” Downie said. “Maybe they have information we didn’t have.

“The Times — whose editorial page, coincidentally, endorsed McCain for the GOP nomination — has been repeatedly denounced by prominent conservatives over national-security stories that relied on unnamed sources.

In 2005, despite a personal appeal by President Bush to Keller and Publisher Arthur Sulzberger Jr., the Times disclosed that the administration was eavesdropping on some Americans and foreigners without court orders. That Pulitzer Prize-winning report also drew complaints from some liberals, because Keller had held it as not ready for publication during Bush’s reelection campaign.

In 2006, Bush called the Times’ conduct “disgraceful” after the paper published details of a secret federal program to monitor the financial transactions of terror suspects.

Several conservatives called for the Times to be prosecuted for violating espionage laws.McCain has famously prided himself on being friendly and accessible to reporters, but that didn’t stop campaign manager Rick Davis yesterday from releasing a fundraising letter calling the Times part of “the liberal attack machine.” Radio host Laura Ingraham said the episode should teach the senator that the major newspapers are run by “partisans” and “piranhas.”