DENVER  Senator Edward M. Kennedy had just left a hospital bed here when he delivered his speech to the Democratic National Convention on Monday night, after suffering a debilitating bout of kidney stones Sunday upon arriving in town, aides said.

Mr. Kennedy’s aides described a harrowing 48-hour period in which it appeared that Mr. Kennedy would not be able to give the convention speech. In June, he had told family members when he left the Duke University Medical Center, where he was operated on for brain cancer, that he was intent on giving the speech.

And with less than two hours to go before he was to take the stage, Mr. Kennedy  sitting unnoticed in a room at the University of Colorado Hospital  told his wife, Victoria, and doctors that he wanted to go to the Pepsi Center and deliver the speech.

He was driven there, accompanied by a doctor and paramedics, perched on a golf cart that took him inside. Mr. Kennedy, with his wife and his niece Caroline at his side, walked gingerly onto the stage, where he delivered a highly acclaimed address. He then returned to the hospital, where he spent the night.