By Jeffrey Toobin. This article originally appeared in print in the May 12, 2008 issue of The New Yorker.

There was a long pause before Ted Sorensen answered the door the other day at his apartment, on Central Park West. In chinos and a tennis shirt, he still had the trim physique that all the New Frontiersmen had during their days of playing touch football on the beach at Hyannis Port. But Sorensen’s gait is unsteady, and his eyes are cloudy. The clutter of the day’s Times was absent; he has trouble reading the newspaper.

Sorensen, who was John F. Kennedy’s closest aide and amanuensis, moved to New York shortly after the assassination, spent several decades practicing law at Paul, Weiss, and procrastinated about writing his memoirs. Still, on July 18, 2001, a historian visited Sorensen in his office and pretty much talked him into starting the job. Two days later, Sorensen suffered a massive stroke while working in his office. He underwent brain surgery immediately and for several days hovered between life and death. In time, his condition stabilized, but the stroke took a toll. “I have visual agnosia, which means I can see shapes and images but I can’t put them together,” he said. “I don’t always recognize people. It’s hard to read much of anything.” Sorensen was compelled to bring his law practice to a close. But a few months later he recruited a Princeton junior named Adam Frankel to serve as his reader, adviser, and muse—his Sorensen—for the memoir project.

Sorensen ordered up reams of files from the Kennedy Library and elsewhere, and the two began, starting with Sorensen’s boyhood, in Nebraska, where his father was the state attorney general and his mother waged a secret battle against mental illness. More than four decades after the fact, he began to reëxamine his relationship with J.F.K.—their lonely travels across the country during the early days of the 1960 campaign, their close (and controversial) collaboration on Kennedy’s book “Profiles in Courage,” and Sorensen’s knowledge of Kennedy’s complex private life. Various additional health problems—including a mini-stroke, prostate cancer, melanoma, a leaky heart valve, and Lyme disease—compounded Sorensen’s difficulties in writing the book.

“What he did was heroic,” Frankel said recently. “Ted never typed and had difficulty reading his own handwriting anymore, so he would dictate for hours, and I would send the tapes to a transcription company, edit them, then give it back to him”—in large type. “Then we’d go over it again and again.” Sorensen would sit between two powerful lamps in order to read. Frankel took on various part-time jobs, but from the spring of 2005 to the spring of 2007 he devoted himself almost exclusively to assisting Sorensen.

In the meantime, Sorensen began following the new Presidential campaign. “I was immediately sympathetic with Obama, because they were saying the same things about him that they had said about Kennedy forty-eight years ago—that he didn’t have a chance from the day he was born, just as J.F.K. didn’t have a chance from the day he was baptized,” Sorensen said. Before Obama announced that he would run, one of Sorensen’s law partners, Jeh Johnson, organized a small get-together among the attorneys for the Illinois senator, and Sorensen prepared talking points about the pros and cons of running. Bad weather prevented Obama from attending, but Johnson sent him Sorensen’s notes. “He called and thanked me,” Sorensen recalled. “We became friends.”

Sorensen fished a message from his secretary out of his pocket. “Look at this,” he said, with what seemed meant to be exasperation but sounded like pride. “They want me to go to Oregon to campaign. Oregon’s a long way away.” Sorensen has become a valued surrogate for Obama on the campaign trail, and has made appearances in Iowa, New Hampshire, Illinois, Missouri, and South Carolina. He is fond of comparing Obama to his old boss: “They both had a totally open, fresh approach that is not so heavily partisan or so freighted with personal ambition that they couldn’t focus on the problems this country faces. People talk about J.F.K.’s charisma or his appearance, but the most important thing that he had was judgment—and that’s what Obama has, too.”

This week, Sorensen’s memoir, “Counselor: A Life at the Edge of History,” will be published, and the author will also celebrate his eightieth birthday. For the festivities, Frankel, who is now twenty-seven years old, will fly in from Chicago, where he has been working as a speechwriter for Obama. “I guess you’d have to say there’s some symmetry there,” Frankel said, when he was reached by telephone at Obama headquarters. “It’s a passing of the torch, or something.”