The White House has been forced to make an embarrassing U-turn after it appeared to have acted rashly in approving the sacking of a senior black official who was being targeted by a controversial rightwing blogger.

The Obama administration had initially supported the decision of Tom Vilsack, the agriculture secretary, to force the resignation of Shirley Sherrod after a misleadingly edited version of a speech she gave in March caused outrage on the internet. The edited clips, put out by Andrew Breitbart of the conservative site BigGovernment.com, who has worked with the leading rightwing blogger Matt Drudge, gave the impression that Sherrod had boasted about having discriminated against a white farmer 24 years ago.

But when the full footage of the speech was released hours later, it became clear that she was recounting the story as a parable for why every poor person deserved to be helped equally, whatever their race.

In the wake of the full tape becoming available, the White House said the case should be looked at again. Vilsack, who initially had said his department had a "zero tolerance for discrimination", also made a startling volte face, promising a "thorough review to ensure to the American people we are providing services in a fair and equitable manner" and offering Sherrod another job in the department.

Last night he went further, saying he had extended his "personal and profound apologies for the pain and discomfort that has been caused to her and to her family over the course of the last several days." He added: "A good woman has gone through a very difficult period, and I will have to live with that for a very long time."

Obama's press secretary Robert Gibbs also grovelled last night, saying: "A disservice was done. An apology was owed. That's what we've done."

Despite such apologies, the damage had already been done with the White House and a key department having acted in haste to force out of office a senior black woman at the whim of rightwing pundits.

To make matters more politically incendiary, it became clear that Breitbart had put together the edited clips in order to hurt the NAACP, America's largest civil rights organisation. The NAACP last week locked horns with the Tea Party movement of disaffected rightwingers, accusing it of tolerating bigotry. Breitbart has admitted he put out the Sherrod video to "show you that people who live in glass houses should not throw stones".

As the furore swirled, Eloise Spooner, the wife of the white farmer in question, came to Sherrod's defence, saying: "We probably wouldn't have our farm today if it hadn't been for her."

Sherrod said she was ordered to resign by Vilsack's deputy, Cheryl Cook, while she was on a long drive, and was even ordered to pull over on the side of the road and send in her resignation by Blackberry.

The saga also embarrassed the NAACP, which was also over-hasty in judging Sherrod, telling Fox News that it repudiated "racists in our ranks". After seeing the full video, it said it had been "snookered" into misinterpreting her views.