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)

Trayvon Martin, the president said, could have been him 35 years ago. That would have been Barack Obama at age 17, then known as Barry and living in Honolulu. He had a bushy Afro. Hoodies were not in style then, or often needed in balmy Hawaii. His customary hangout outfit was flip-flops, called “slippers” on the island, shell bracelet, OP shorts and a tee.

Imagine if Barry Obama had been shot and killed, unarmed, during a confrontation with a self-deputized neighborhood watch enforcer, perhaps in some exclusive development on the far side of Diamond Head after leaving home to get shave ice. The news reports would have painted a complicated picture of the young victim, a variation on how Martin was portrayed decades later in Florida:

Lives with his grandparents; father not around, mother somewhere overseas. Pretty good student, sometimes distracted. Likes to play pickup hoops and smoke pot. Hangs out with buddies who call themselves the Choom Gang. Depending on who is providing the physical description, he could seem unprepossessing or intimidating, easygoing or brooding. And black.

On the inside, the young Obama had already begun a long search for identity — and by extension a study of the meaning and context of race. His mother and maternal grandparents were white. He was not. He lived in one culture, and the skin color passed along to him by his absent father placed him inalterably in another, in the eyes of others. How and why did race define him, limit him, grace him, frustrate him, alienate him, propel him and connect him to the world?

His effort to reconcile those questions and figure himself out was his quest. It took him off the island to Los Angeles, New York and Chicago, where he finally found a sense of belonging and comfort in the black community. It took him into writing, and then politics. He wrote a book about it. “Dreams From My Father” is not so much an autobiography as a coming-of-age memoir filtered through the lens of race. As a state senator in Illinois, where he worked on legislation to overcome racial profiling, some African American colleagues dismissed him as not being black enough. As a candidate for president, when he was linked to a fiery black preacher, some white detractors said he hated white people. He eventually reached the presidency on a theme meant to answer both extremes. His idealistic message was that people yearned to transcend the differences that kept them apart, race prime among them.

Once Obama reached the White House, it appeared that his intense interest in the subject diminished. He would be judged by the content of his presidency, not the color of his skin. Race seemingly became unimportant, if not irrelevant, to the first black president of the United States. He rarely spoke about it, only when circumstances pressed him — once when a notable African American Harvard professor was detained by a cop for forcibly entering his own home after being locked out, and again when a jury found the man who shot Martin not guilty.

“Whoa!” some White House correspondents shouted Friday afternoon when President Obama strode unexpectedly into the press briefing room. They were anticipating another routinized exchange with Jay Carney, the press secretary; instead they got his boss, who said he wanted “to just talk a little bit about context and how people have responded” to the Martin ruling. Obama went on: “When Trayvon Martin was first shot, I said that this could have been my son. Another way of saying that is Trayvon Martin could have been me 35 years ago. And when you think about why, in the African American community at least, there’s a lot of pain around what happened here, I think it’s important to recognize that the African American community is looking at this issue through a set of experiences that — that doesn’t go away.”

If there is no such thing as a typical African American experience, Barack Obama nonetheless grew up somewhat apart from the norm. His black father came from Africa, not urban America or the rural South. Barry lived in places — Hawaii and Indonesia — where there were few people who looked like him. He had to learn African American cultural and social history on his own. Yet the most superficial aspect of his being, his physical appearance, connected the future president to that “set of experiences that — that doesn’t go away.”

Obama was still a chubby adolescent, just returned from Indonesia and enrolled at the prestigious Punahou School, when he suffered the first such experience. He was one of the kids who played tennis after school, sometimes entering tournaments. One day he and some friends were looking at the draw sheets that had just been posted for a tournament when the tennis pro barked out that Barry shouldn’t touch the board, because his color might rub off.

“He singled him out, and the implication was absolutely clear,” classmate Kristen Caldwell later recalled. “Barry’s hands weren’t grubby, the message was that his darker skin would somehow soil the draw. Those of us standing there were agape, horrified, disbelieving. Barry handled it beautifully, with just the right amount of cold burn without becoming disrespectful. ‘What do you mean by that?’ he asked firmly.”

A few years later, in front of Obama, an assistant basketball coach spoke disparagingly about some players from a different school during a pickup game, using the most volatile racial epithet. When challenged, he said it did not apply to Barry, who was different. In basketball, one can see how the crosscurrents in racial perceptions flow in all directions. Obama would later write that he felt he got less playing time on Punahou’s varsity basketball team than his talent warranted because his style of hoops was less rigid, more playground, a “black” form of ball. His teammates remembered it somewhat differently, that he was at best the eighth-most-talented player and one of the few who could not dunk.

Jesse Jackson used to talk about the time he was standing at the front of a hotel, waiting for a ride, when a man walked up to him, assumed he was the bellman and handed him a suitcase — a less dangerous but common form of racial stereotyping. Writing in the Wall Street Journal after the 2008 election, Katherine Rosman recalled a Manhattan book party five years earlier where she felt out of place and found solace talking to an equally awkward-seeming black man. It was Obama. Another guest later confessed he had mistaken him for a waiter and asked him to fetch a drink.

In his statement Friday in the White House briefing room, Obama identified himself with his cohort of African American men. Few of them, he said, “haven’t had the experience of being followed when they were shopping in a department store. That includes me.” And many, including him, have heard a car door click locked as they have walked across a street, he said, or stepped on an elevator to find a “woman clutching her purse nervously” until she got off. Those situations, he said, “inform how the African American community interprets what happened one night in Florida. And it’s inescapable for people to bring those experiences to bear.”

In Obama’s search for identity, he figured out how to straddle different worlds. In terms of family, he realized that he would find the comfort of home only in black society. But beyond that, in his professional life and outlook, he believed that he could not confine himself to one perspective, that his unusual composition offered him an unusual platform. As he wrote in a letter when he was 21, he felt compelled to embrace it all, not choose one societal niche. His inclination, then and later, was to try to smooth and comfort, not confront.

But Friday afternoon at the White House, Obama was speaking not so much as a president addressing the populace but as a black man addressing white society. It was a rare case where he was speaking only as what he inherently is rather than what he wanted to be.

Maraniss is an associate editor with The Washington Post and the author of the 2012 book “Barack Obama: The Story.