NEW YORK – President John F. Kennedy’s aide and speechwriter, Theodore C. Sorensen, a symbol of hope and liberal governance, died at age 82 during a time of contempt for Washington and political leaders.

Sorensen’s passing Sunday came just as supporters of his friend and boss were preparing to celebrate the 50th anniversary of a very different moment in history: The election of Kennedy as president and the speech that remains the greatest collaboration between Sorensen and Kennedy and the standard for modern oratory.

With its call for self-sacrifice and civic engagement — “Ask not what your country can do for you, ask what you can do for your country” — and its promise to spare no cost in defending the country’s interests worldwide, the address is an uplifting but haunting reminder of national purpose and confidence, before Vietnam, assassinations, Watergate, terrorist attacks and economic shock.

Sorensen died at Manhattan’s New York Presbyterian Hospital/Weill Cornell Medical Center from complications of a stroke. He had been in poor health in recent years and a stroke in 2001 left him with such poor eyesight that he was unable to write his memoir, “Counselor,” published in 2008. Instead, he had to dictate it to an assistant.

President Obama said he was saddened to learn of Sorensen’s death. “I know his legacy will live on in the words he wrote, the causes he advanced, and the hearts of anyone who is inspired by the promise of a new frontier,” Obama said.