Sen. Judd Gregg says it was a "mistake" to accept President Obama's nomination.

"I realize that to withdraw at this point is really unfair in many ways," the three-term New Hampshire Republican said.

"But to go forward and take this position and then find myself sitting there and not being able to do the job the way it should be done on behalf of the president, 100 percent, that would have been an even bigger mistake."

Gregg said Obama had been "incredibly gracious" during the process, and that it was "my mistake, obviously, to say yes." He added that he would "probably not" seek re-election in 2010.

Gregg would have been the third Republican to join the Democratic administration, following Defense Secretary Robert Gates and Transportation Secretary Ray LaHood.

Don't Miss

"Mr. Gregg approached us with interest and seemed enthusiastic," he told State Journal-Register in Springfield, Illinois. "But ultimately, I think, we're going to just keep on making efforts to build the kind of bipartisan consensus around important issues that I think the American people are looking for."

White House Press Secretary Robert Gibbs issued a statement late Thursday afternoon saying "we regret that he has had a change of heart."

"Sen. Gregg reached out to the president and offered his name for secretary of commerce. He was very clear throughout the interviewing process that despite past disagreements about policies, he would support, embrace and move forward with the president's agenda," Gibbs said.

"Once it became clear after his nomination that Sen. Gregg was not going to be supporting some of President Obama's key economic priorities, it became necessary for Sen. Gregg and the Obama administration to part ways." iReport: Share your thoughts on Gregg's withdrawal

Senate Minority Leader Mitch McConnell welcomed Gregg's withdrawal.

"Sen. Gregg made a principled decision to return and we're glad to have him," McConnell, R-Kentucky, announced. "He is among the smartest, most effective legislators to serve in the Senate -- Democrat or Republican -- and a key adviser to me and to the Republican conference. It's great to have him back."

All but three Republicans in the Senate have opposed the now-$789 billion stimulus bill, which Obama argues is necessary to prevent a more severe economic skid.Gregg did not cast a vote Tuesday when the Senate considered the economic stimulus package.

Gregg, a member of the Senate Appropriations Committee and of the subcommittee that oversees the Commerce Department, cast a vote in 1995 to abolish the entire department, and in 1999 opposed emergency funding for the 2000 census.

African-American and Latino leaders raised concerns that the Census Bureau, which is part of the Commerce Department, might lack sufficient resources under Gregg's leadership to accurately count ethnic minorities. The White House responded by saying it would work closely with the bureau's next director to ensure "a timely and accurate count" in 2010.

That led Republican leaders in the House of Representatives to accuse the White House of putting the census under the control of "political operatives."

But a Republican source close to Gregg said the census "tipped things," adding to increasing concerns that he might be marginalized within the administration.

"Basically, if on any issue important to Democratic constituencies they are on one side and Judd is on the other, he is muted," the source said.

A Republican aide familiar with Gregg's decision said he had been consulting with GOP leaders privately about this move for the "past couple of days."

A Democratic source close to the Obama White House said Thursday that Gregg "campaigned for the job" -- that the senator from New Hampshire asked Senate Majority Leader Harry Reid to approach the president about the Commerce post. Watch pundits debate the politics behind Gregg's move »

Gregg "sat with [Obama], said he wanted the job, knew his policies and erratically dropped out without warning," said the source, minutes after the Republican senator announced his withdrawal from consideration.

Gregg is Obama's third Cabinet nominee to withdraw, following last week's decision by Health and Human Services Secretary-designate Tom Daschle to quit over tax issues and the withdrawal of Obama's previous Commerce Department pick, New Mexico Gov. Bill Richardson. Interactive: Other nominees that have withdrawn »

Richardson withdrew in early January, citing the distraction of a federal investigation into whether he played an improper role in directing state business to a company that donated to his political action committees.

With Republicans holding only 41 seats in the Senate, Gregg said he would take the Cabinet post only if his replacement was a fellow Republican. New Hampshire Gov. John Lynch agreed, announcing plans to replace Gregg with the senator's former chief of staff, Bonnie Newman.