(CNN) -- Theodore C. Sorensen, a close adviser and speechwriter to President John F. Kennedy, has died, the White House said Sunday.
He was 82.
Though he wore a number of hats in his relationship with Kennedy and later in life, he is best known publicly as the wordsmith who helped put Kennedy's ideas to paper in what remain some of the most recognizable speeches in American political history.
The youngest top official in the Kennedy White House, Sorensen was an influential policy adviser and a presidential confidante.
He served as special counsel and speechwriter to Kennedy from 1961 to 1963, and participated in secret White House meetings during the Cuban Missile Crisis, according to the John F. Kennedy Presidential Library.
Sorensen was a key aide on Kennedy's 1960 presidential campaign and had earlier served as a speechwriter and assistant to Kennedy during his Senate years.
After Kennedy's 1963 assassination, Sorensen helped to shape the young president's legacy, writing four books on the Kennedy years, including the 1965 volume "Kennedy."
Sorensen also played an important role in helping the future president shape 1956's "Profiles in Courage."
A 2008 memoir, "Counselor: A Life at the Edge of History," was a candid look at his relationship with Kennedy.
Sorensen was often asked whether he wrote the classic line from Kennedy's 1961 inaugural address, "Ask not what your country can do for you; ask what you can do for your country."
"Having no satisfactory answer, I long ago started answering the oft-repeated question as to its authorship with the smiling retort: 'Ask not,' " Sorensen wrote in "Counselor."
The lawyer later served as special counsel to President Lyndon B. Johnson in 1963 and 1964.
Sorensen played a major role in completing Sen. Robert F. Kennedy's book "Thirteen Days," based on notes left after the latter's 1968 assassination.
"I got to know Ted after he endorsed my campaign early on," President Barack Obama said in a statement Sunday. "He was just as I hoped he'd be -- just as quick-witted, just as serious of purpose, just as determined to keep America true to our highest ideals."
A native of Lincoln, Nebraska, Sorensen received his law degree in 1951, according to the publication Current Biography. He soon became an administrative assistant to Kennedy, then a newly elected U.S. senator from Massachusetts.
A chief goal was getting Kennedy elected president. Sorensen's efforts included helping Kennedy overcome anti-Catholic prejudice during the successful 1960 campaign.
Sorensen's later career included serving as an attorney in Manhattan, attending Democratic conventions and serving as a presidential and political adviser, according to the JFK Library.