Mr. Eddafali and his family had immigrated to the United States from Morocco in 1999, when he was 6, and he spent years reconciling his Muslim faith with his emerging American identity. A standout basketball player in high school, the boy who had endured ethnic slurs and playground bullying after the Sept. 11 attacks now proudly heard classmates chant his name at games. He found he could navigate fluidly among students of different races and backgrounds, an interlude that felt magical.

“When you found the pocket,” he said of that time, “it was bliss.”

Beside him in the pocket was his friend Jahar, the sociable wrestling team captain who had come to the United States with his family from Kyrgyzstan in 2002, when he was 8, and also knew the challenge and the triumph of acceptance. They had met in middle school, when both were becoming chameleons, Mr. Eddafali said, honoring their families’ Muslim faith at home while maintaining separate lives as fully American teenagers.

They trained as lifeguards together, worked together at the Harvard pool, partied with their “boys” beside the Charles River. Both were well-liked, athletic, bound for college, examples of the immigrant success story that progressive, multicultural Cambridge loves to tell.

Until all at once, one of them wasn’t.

So unfathomable was Dzhokhar Tsarnaev’s violent turn that many of his friends did not believe it, even when photos of the brothers flooded the media a few days after the bombing.

Small moments in their shared history made the news seem inconceivable. The lunches he bought classmates who were short on cash. The pep talks he gave teammates when they hit the wall. Even in college, where he failed classes and sold drugs, Jahar still encouraged friends, they said, urging one to develop her talent for drawing in art school.