As a young boxer, Muhammad Ali searched for a faith to guide him as he confronted the indignities of racial discrimination. What he found was the Nation of Islam, the controversial black Muslims who preached a doctrine of strict separation of the races and described white people as devils.

The move to a group feared by whites and rejected by many blacks stunned fans who were dazzled by the showmanship, quick wit, and fast fists of the boxer who had won an Olympic gold medal as Cassius Clay. But Ali, who adopted a Muslim name, didn't waver amid withering criticism. He resisted calls to join black civil rights activists, declaring that forced integration wouldn't work.

Ali parted ways with the Nation after about a decade, embracing mainstream Islam, which teaches that believers should embrace all races and ethnicities. He remained a devout Muslim until his death last week at age 74. As one of the most famous Muslims in the world, he traveled widely as a goodwill ambassador, spreading the message of Islam as a religion of peace.

But Ali's decision to join the Chicago-based Nation of Islam more than 50 years ago reflected a recurring theme in his life: a willingness to defy the establishment and do what he believed was right. He offered no apologies for aligning himself with the polarizing group. He found comfort there.

"The Nation did provide him a sense of belonging and group support," says Larry Mamiya, professor emeritus at Vassar College who has studied the group for four decades. "It enabled him to be himself in a world where his sport was controlled by whites. But his charismatic presence also enabled the Nation to attract new members. So it worked both ways."

While Martin Luther King Jr. preached nonviolence, Ali preferred the Nation's emphasis on self-defense, says Mamiya, pointing to the group's most celebrated member, Malcolm X, who believed "if you hit me, I'll hit you back." Ali also was attracted to the group's core principles — '''know yourself" and "do for self," a message of financial independence that led to many Nation members becoming merchants, the professor adds.

Ali went public with his membership in the Nation in 1964, shortly after defeating Sonny Liston for the heavyweight title. He abandoned what he called his slave name, Cassius Clay, and briefly was known by Cassius X before declaring: "I am Muhammad Ali, a free name — it means beloved of God and I insist people use it when speaking to me and of me."

Ali's interest in the Nation began in his high school years in Louisville, when he lived under the yoke of Jim Crow laws, even after returning home with an Olympic gold medal in 1960. In 1962, he attended a Nation of Islam conference in Detroit and was captivated by the words of Elijah Muhammad, the group's leader, and the more dynamic Malcolm X, Mamiya says.

In a 1964 interview with The Associated Press in which he formally declared himself a Muslim, Ali said he didn't like the phrase "Black Muslims," and described Islam as "the true way to save the world, which is on fire with hate." He declared "forced and token integration" was a "pacifier," or temporary solution to problems blacks face, and one group should not impose its culture on another.

"They have been telling me I should carry signs, that I should join integration marches," he said. "They tell me it would be fine if I married a white woman — it would be good for brotherhood. I don't buy this. I don't want to get blown up. I don't want to be washed down the sewer. I don't want to go to jail."

Ali also emphasized he didn't hate anyone. "I like white people. I like my own people," he said. "They can live together without infringing on each other. You can't condemn a man for wanting peace — if you do, you condemn peace itself."

The Nation's appeal wasn't that unusual in the turbulent 1960s as black pride, black power and African names became more popular. Ali saw the alternative — blacks beaten, jailed and murdered in civil rights struggles, says Harry Edwards, an expert on black athletes and professor emeritus of sociology at the University of California-Berkeley.

"The mainstream asked that we continue to have faith in a constitution and a government that was clearly not working for us," Edwards says. "If you're going to have faith, at least have faith in something that advocates for you. That's what the Nation of Islam was. ... Ali simply had the courage of his convictions. His relationship with Malcolm X cemented the deal."

Malcolm X became Ali's mentor and close friend. Their relationship ruptured when Malcolm X split from the Nation after disclosing Elijah Muhammad had fathered several out-of-wedlock children with his secretaries. Ali remained loyal to Muhammad, whose son, Jabir Herbert, was the boxer's longtime manager

Two years later, Ali refused to be drafted into the U.S. Army, citing his religious convictions. He was stripped of his heavyweight title and didn't box for more than three years. The U.S. Supreme Court overturned his conviction on draft evasion charges. During his exile, Ali "was surprised, disappointed and ... devastated" by the lack of support among some Nation members, Edwards says. And, he adds, Ali also regretted he hadn't reconciled with Malcolm X before his assassination in 1965.

In 1975, after Elijah Muhammad died, his son, Imam W.D. Mohammed, succeeded him and moved the group toward orthodox Sunni Islam. Ali was a faithful member, providing some star power by appearing at some of W.D.'s speeches. (Those who rejected the transformation and still accepted Elijah Muhammad's teachings followed Louis Farrakhan as a new leader of the Nation of Islam.)

In his later years, Ali studied Sufism, a mystical Islamic tradition. His book, "The Soul of a Butterfly," quotes Sufi sayings and stories extensively.

Ali will be buried Friday in Islamic tradition, his body facing Mecca.