WASHINGTON — Barack Obama was riding his call for generational change to the Democratic presidential nomination in the spring of 2008 when he began musing about potential running mates with aides traveling with him on the trail.

[Election 2020: Joe Biden and Barack Obama join forces against Trump.]

“I want somebody with gray in his hair,” Mr. Obama, then 46, told one of them. He was thinking about an “older guy,” he told another.

That older guy, people around the candidate would soon learn, was Joseph R. Biden Jr., 65, a has-been to pundits but to Mr. Obama a sweet-spot pick — a policy heavyweight with limited political horizons, assuming that would ensure loyalty and minimal drama. Mr. Obama was already phoning Mr. Biden two or three times a week to solicit advice, and to decide whether the Delaware senator’s many positive attributes outweighed his singular liability, a notoriously self-tangling tongue.

Over the next several months, Mr. Obama’s top advisers would present 30 alternatives, all of whom he respectfully considered. But his preference was clear from the start. When it came time to decide in August, Mr. Obama chose Mr. Biden over two younger finalists — Tim Kaine, the governor of Virginia, and Senator Evan Bayh of Indiana, peers in the mold of Bill Clinton’s choice of Al Gore in 1992.