Montgomery County Executive Isiah Leggett, left, and Prince George's County Executive Rushern L. Baker III are pictured on the cover of a photo album Leggett created to chronicle their friendship and political partnership. Both are leaving office Monday. (Arelis R. Hernandez/The Washington Post)

It is their favorite picture together.

The law professor and his student are grinning, clad in stylish black shades and sitting side by side, laughing as if sharing a joke only the two of them understood. The caption reads, “Friends for Life.”

The inside joke is this: One of the two men never expected to be there.

By his own telling, Rushern L. Baker III, the outgoing Prince George’s County executive, was not the greatest student at Howard University School of Law in the mid-1980s. Isiah Leggett — who will step down as Montgomery County executive on Monday, the same day Baker leaves office — was the intimidating dean who didn’t let him give up.

More than three decades later, the two Democrats are leaving the top political job in neighboring Maryland counties having evolved into partners in public service. They have leaned on one another for advice and offered support for each other’s most ambitious initiatives.

The two couldn’t be more different in style and personality. But their bond carried them through tough budget negotiations and other governing challenges in Maryland’s two largest jurisdictions, as well as personal tragedies

“He was the person I always ran to when I was in trouble,” Baker, 60, said of Leggett, 74. “I never had to explain anything. He just understood.”

Leggett jokes with Baker, right, outside a polling station in Silver Spring, Md., in June, when Baker was running for governor in the Maryland Democratic primary. (Bonnie Jo Mount/The Washington Post)

The photo of the smiling pair is the opening image of an album Leggett put together for Baker to mark the end of their parallel journeys. It was taken at the groundbreaking for the Purple Line — a light rail project that will someday connect their two counties and that both men worked hard to push through.

Leggett, a Vietnam veteran, is not a demonstrative guy. But he was emotional as he presented the gift at a farewell celebration for Baker on Nov. 19. Inside are blown-up photos of the two of them at events at Howard University, of Baker giving Leggett a tour of his county administrative offices and of each endorsing the other at political events.

As part of his presentation, Leggett read a lengthy proclamation that detailed Baker’s entire professional biography and listed his accomplishments in Prince George’s one by one.

“I hereby make Rushern Baker an honorary resident of Montgomery County,” he said at the end, prompting laughter from the audience and a shriek from Baker, who quickly responded, “Now I know what I’m doing next.”

Leggett included a personal note in the scrapbook he gave to Baker. (Arelis R. Hernandez/The Washington Post)

Inside the album, Leggett left Baker a handwritten note.

“I wanted him to know how proud I am of him and his achievements,” Leggett said later.

Baker said he felt 25 again when Leggett paid tribute to him, as if he were back in law school, scared of flunking and in awe of the man who, for him, epitomizes black achievement.

“He is somebody who was put in my life that helped me start a career,” Baker said. “Now to be going out with him, it’s emotional.”

Leggett was there for him, Baker explained, after the deaths of Baker’s father and of his longtime political mentor, former Prince George’s County executive Wayne K. Curry. He was there when Baker could no longer consult with his wife, Christa Beverly, who suffers from early-onset Alzheimer’s disease.

Throughout the years, Leggett tried to emphasize to Baker that their relationship had changed, and he was no longer the subordinate. They had become equals.

But Baker never bought that: “He will always be the dean to me.”

Baker and Leggett embrace after Leggett presented Baker with a scrapbook of their friendship during a Baker farewell event in Upper Marlboro on Nov. 19. (Arelis R. Hernandez/The Washington Post)

Baker, left, and Leggett tour the Reginald F. Lewis Museum of Maryland African American History & Culture in Baltimore in 2015. They visited Baltimore to have lunch with Then-Mayor Stephanie Rawlings-Blake in a show of solidarity after riots there the week before. (Amanda Voisard/for The Washington Post)