President Obama discussed the George Zimmerman acquittal in the killing of teenager Trayvon Martin during a surprise appearance at the White House briefing on Friday. (The Washington Post)

President Obama’s comments on Friday about the killing of Trayvon Martin were remarkable in many respects, but not least because of the distance he has traveled since the equally notable speech he delivered in 2008 during the controversy about his former pastor, the Rev. Jeremiah Wright.

When Obama — then an aspirant to the presidency — spoke in 2008, he sought to translate and explain the grievances, fears and resentments of both whites and blacks concerning the volatile topic of race in America. He spoke as a bridge builder who was trying to give something close to equal weight to the views of each side.

On Friday, he again sought to calm a roiling controversy, but he spoke as an African American who happened to be president, and he spoke to explain why the not-guilty verdict for George Zimmerman has been so difficult for so many African Americans to accept.

Both speeches — one a formal address to an audience at the National Constitution Center in Philadelphia, the other informal remarks delivered in the White House briefing room — displayed Obama’s eloquence and intellectual facility. But the motivations behind them were dramatically different.

In 2008, Obama’s candidacy was rocked by revelations about shocking and racially divisive comments his then-pastor had made from the pulpit of Trinity United Church of Christ in Chicago.

For Obama, this was a personal political crisis. He had joined that congregation as a young community organizer. Wright had presided over his marriage to Michelle Robinson and baptized their children. The title of Obama’s second book, “The Audacity of Hope,” was taken from one of Wright’s sermons.

Throughout his campaign, Obama had tried to transcend the issue of race. He was, as the saying went, a post-racial candidate, not an extension of the civil rights generation of black leaders who had preceded him.

In an interview later in the campaign, Obama told me this: “What you had was a moment where all the suspicions and misunderstandings that are embedded in our racial history were suddenly laid bare.”

He knew he could neither look away from the controversy nor escape it. He had to confront it or risk seeing his candidacy destroyed. “If we had not handled the Reverend Wright episode properly,” he said in that interview, “I think we could have lost.”

Jon Favreau, his speechwriter, was tasked with composing a draft but did so only after a lengthy conversation with the candidate. He knew the speech had to be that personal. Obama then took the draft and rewrote it. “This is really complicated,” he told friend and adviser Valerie Jarrett in a telephone call late one night as he worked on it. He finished the speech around 2 a.m. on the day he was to deliver it. “I think it’s good,” he told friends that morning.

He talked that day in April 2008 about “the complexities of race in this country that we’ve never really worked through — a part of our union that we have yet to perfect.” He explained the roots of the anger in the black community and the resentment in the white community and the need for each side to understand the other.

He later told me, “I thought it was very important at that point for me to help translate the experiences both of Reverend Wright, but also how ordinary white Americans might feel in hearing Reverend Wright and how both sets of experiences were an outgrowth of our history and had to be acknowledged and dealt with, instead of just papered over or reduced to a caricature.”

The president was slower to speak in the wake of the verdict in the Zimmerman trial last weekend. He issued a written statement but otherwise remained silent as the rest of the country engaged in a sometimes stormy debate about whether the man who killed Martin should have gone free.

Only the president and perhaps the first lady know the full story of how he came to do and say what he did Friday. He told advisers Thursday that he wanted to speak out but that he did not want to give a formal speech, as he had in 2008. He chose a setting that was understated in the extreme — a surprise appearance before unsuspecting reporters on a Friday afternoon.

Obama faced a personal political crisis when he spoke about Wright. That was not the case Friday. But his comments were far more personal than those he made in 2008. Equally important, his words were not an effort to balance the scales or to give equal weight to the views of those who believe the jury was correct to declare Zimmerman not guilty of second-degree murder or manslaughter and those outraged by the verdict.

He barely mentioned George Zimmerman. He said he would let legal analysts and talking heads deal with the particulars of the case. Instead, his comments were all about Trayvon Martin and the black experience in America. “I think it’s important to recognize that the African American community is looking at this issue through a set of experiences and a history that doesn’t go away,” he said.

This is, after all, a president who wrote a book — “Dreams From My Father,” about his search for racial identity as the child of a white mother and an absent black African father. He has thought long and hard about the complexities of race in America, and it was clear from what he said Friday that this is something he and his wife talk about privately.

He spoke not just as an African American but also as an African American male — “Trayvon Martin could have been me 35 years ago” — in a country where young African American males regularly die from gunshots or are, as he noted had happened to him, subject to being followed while shopping in a department store, no matter how innocently, or who can hear the locks on car doors click when they walk along a street.

He talked about an African American community that has seen “racial disparities” in the application of criminal laws. “Now this isn’t to say that the African American community is naive about the fact that African American young men are disproportionately involved in the criminal justice system, that they are disproportionately both victims and perpetrators of violence,” he said. “It’s not to make excuses for that fact, although black folks do interpret the reasons for that in a historical context.”

The president is rightly skeptical of calling for a national conversation on race, knowing that however much progress has been made over the past half-century, racial divisions and discrimination do and will persist. What he did was something no other American president could have done — giving voice, in calm and measured terms, to what it means still to be black in America.