Richard J. Whalen, the author of a best-selling biography of the political patriarch Joseph P. Kennedy who later served as a speechwriter on Richard M. Nixon’s 1968 presidential campaign but quit after becoming disillusioned with the candidate, died July 18 at a nursing home in Yorktown, N.Y. He was 87.

The cause was pneumonia, said his daughter, Laura Whalen Aram.

In 1962, Whalen’s editors at Fortune magazine assigned him a profile of Kennedy, then the father of President John F. Kennedy. The elder Kennedy had made a fortune in various businesses and circulated at the highest levels of the political elite, but little was known about the arc of his life or how he operated behind the scenes.

The profile caused a frenzy in publishing, with editors scrambling to get Whalen to expand the article into a book. “The Founding Father: The Story of Joseph P. Kennedy” was published in 1964 to enthusiastic reviews. It was a finalist for the Pulitzer Prize and the National Book Award.

Writing in the National Review, Joan Didion called the biography “fine and hauntingly detailed, evoking the image of a man whose most stunning characteristic was the naked and sustained force of his want.” She added, “It is precisely because Whalen recognizes Kennedy as a literary character that his book is so brilliantly memorable.”

The next year, Whalen moved from New York to Washington to join the Center for Strategic and International Studies as a writer-in-residence, a position that would launch a career in politics that, in addition to Nixon, led him to advise presidents Ronald Reagan and George H.W. Bush.

In 1967, Nixon admired an article Whalen wrote on nuclear defense while working at the bipartisan think tank. Preparing for a second White House run, Nixon invited him to join his speechwriting staff, and Whalen worked on speeches about the Vietnam War and foreign policy.

As the campaign went on, Whalen – one of the “bright young men” Nixon liked to brag about on his staff – soured on the candidate and his political advisers. He quit in 1968 shortly after the Republican National Convention and wrote “Catch the Falling Flag” (1972), a searing memoir of his time with Nixon.

“I was ashamed of being in the company of mediocre merchandisers behind a facade concealing a sad mixture of cynicism, apprehension, suspicion, and fear – especially fear,” he wrote.

Conservatives praised the book, which was published a month before the break-in at the offices of the Democratic National Committee in the Watergate complex. The ensuing coverup and scandal led Nixon to resign in 1974.

“This bitter book is a documentary of disillusion,” William F. Buckley Jr. wrote in his syndicated column. “Whalen expected a great deal from Richard Nixon, and slowly he concluded that Richard Nixon was purely a political functionary, without any thought at all except to enhance his fortunes.”

Richard James Whalen was born in Brooklyn on Sept. 23, 1935, and grew up in South Queens. His father was a textile executive, and his mother was a bookkeeper.

He studied English and political science at Queens College, receiving a bachelor’s degree in 1957. He played on the baseball team and founded New Poems, a campus literary magazine. His poetry helped woo fellow student Joan Giuffré. They married in 1957.

The same year, he joined the Richmond News Leader as a reporter covering school desegregation. He later became an editorial writer at the paper working for James J. Kilpatrick, a prominent conservative columnist.

Whalen joined Time in 1960, primarily reporting from the South on civil rights protests before Fortune magazine tapped him to write editorials and feature stories.

After leaving the Nixon campaign, Whalen served as an informal adviser to Secretary of State William P. Rogers, writing his “State of the World” report. He also wrote for the Saturday Evening Post, Harper’s Magazine, and The Washington Post.

In addition, he started Worldwide Information Resources, an international news service. After Reagan’s election in 1980, Whalen served as an informal adviser on foreign affairs, trade, and other matters, regularly visiting him in the Oval Office. He also advised George H.W. Bush.

Whalen was also a lobbyist and strategist for Toyota.

In addition to his daughter, of Elkridge, Md., survivors include his wife of 65 years; two sons, R. Christopher Whalen of Briarcliff Manor, N.Y., and Michael Whalen of Queens; a brother; and four grandchildren.

Whalen acknowledged the odd position he found himself in as the author of a book so highly critical of Nixon during a reelection year.

“The reason is obvious: anyone who helps elect a President usually has a strong interest in seeing him reelected,” he wrote in the preface to “Catch the Falling Flag.” “This portrait of Nixon as candidate and President is offered without concern for the partisan consequences. My only loyalty is to the survival of America in freedom, and we are weaker and less free today than we were when Nixon entered the White House.”