Barack Obama deepened his connection to America's most fabled political clan yesterday by stepping in for the indisposed senator Ted Kennedy to deliver a university graduation address on public service.

Hillary Clinton also spent the day remembering the former first family, although in her case she was struggling to contain the damage from a clumsy remark about the assassination of Robert Kennedy in 1968 on the campaign trail.

On a sunlit lawn in Connecticut, Obama replaced Senator Kennedy, who was diagnosed with a malignant brain tumour last week, to deliver the address at Wesleyan University.

His speech was evocative of the late John F Kennedy's call to public service in his 1961 inaugural address, although Obama did not quote the most famous line: "ask not what your country can do for you".

But Obama did pledge to double the Peace Corps, which was founded by Kennedy, and urged graduates to work on environmental and anti-poverty causes.

"After today, you have no excuses. I am asking you, and if I should have the honour of serving this nation as president, I will be asking again in the coming years," he said.

"I intend to make it a cause of my presidency, and I believe with all my heart that this generation is ready, and eager, and up to the challenge."

The symbolism of Obama's appearance at Wesleyan was unmistakable, bestowing the Kennedy family stamp of approval just as the Democrat frontrunner is about to clinch his party's nomination.

Obama has drawn closer to the nomination every day with a steadily accumulation of support from superdelegates. Yesterday, he reached 1,975, putting him just 51 delegates away from the figure of 2,025 which would give him the Democratic nomination sought.

Clinton was on 1,779 delegates. Her campaign, more than $20m in debt, last week began to show signs of winding down, with a greatly reduced schedule.

This weekend Clinton was widely criticised on television and on blogs for mentioning Robert Kennedy's run for the White House, and his assassination, while trying to press her case for continuing to fight against Obama.

Although Clinton issued an almost immediate apology, and circulated an email from Robert Kennedy's son excusing the comments, she was obliged to publish a letter in the New York Daily News yesterday further explaining the comments.

"I want to set the record straight: I was making the simple point that given our history, the length of this year's primary contest is nothing unusual," Clinton wrote.

"I realise that any reference to that traumatic moment for our nation can be deeply painful, particularly for members of the Kennedy family, who have been in my heart and prayers over this past week. And I expressed regret right away for any pain I caused."

Clinton also tried to offer an explanation of why she has stayed in the race for the Democratic nomination despite Obama's virtually insurmountable lead, arguing that she owed it to her supporters, especially women, and that she still believed she would be a better candidate against the Republican John McCain.

Howard Wolfson, a Clinton aide, meanwhile accused the Obama campaign of trying to stir up sentiment about the comments. "I think what the Obama campaign did on Friday was unfortunate," he told CBS.

However, a number of commentators said Clinton's comments could hurt her chances of negotiating a cabinet post in an Obama White House, or the vice-presidential spot.

Aides for both Clinton and Obama have denied any such discussions. But Bill Clinton, the former US president, reportedly has been pressing for his wife to be the vice-presidential candidate.