(CNN) -- President Obama delivered his long-awaited and wide-ranging speech Thursday on American and Muslim relations, offering a hand of friendship to Islam and addressing an array of quandaries and conflicts dividing the two cultures.

President Obama urges a new chapter in ties between the U.S. and Muslims in a speech Thursday in Cairo, Egypt.

At Egypt's Cairo University, Obama quoted from the Quran as he expounded on Islam's glories and rights, the legitimate rights of Israel and the Palestinians, Iranian nuclear aspirations, the wars in Iraq and Afghanistan, women's rights, economic development, and religious rights and democracy in the Muslim world.

The address, billed as a fence-mending mission between the United States and Islam, urged those present and the people across the globe viewing the speech on television to enter a new, productive and peaceful chapter in their relationship.

Obama's stop in Egypt is part of a trip that started in Saudi Arabia on Wednesday and will continue later to Germany and France. Watch Obama's entire speech »

"I know there are many -- Muslim and non-Muslim -- who question whether we can forge this new beginning," Obama said, emphasizing that "it is easier to start wars than to end them. It is easier to blame others than to look inward, to see what is different about someone than to find the things we share."

Obama reiterated a statement he made in Turkey in April.

"In Ankara, I made clear that America is not -- and never will be -- at war with Islam.

"We will, however, relentlessly confront violent extremists who pose a grave threat to our security -- because we reject the same thing that people of all faiths reject: the killing of innocent men, women and children. And it is my first duty as president to protect the American people."

Obama explored the Palestinian and Israeli conflict, endorsing a two-state solution and urging compromise and understanding between "two peoples with legitimate aspirations." iReport.com: A reaction to Obama's speech

And then he entered into the conflict's thickets, understanding claims from both sides. He said the United States "does not accept the legitimacy of continued Israeli settlements" seen by Muslims as impediments to Middle East peace. Watch as Obama seeks a "new beginning" »

"This construction violates previous agreements and undermines efforts to achieve peace. It is time for these settlements to stop."

Calling America's "strong bond" with Israel "unbreakable," he said, "It is based upon cultural and historical ties and the recognition that the aspiration for a Jewish homeland is rooted in a tragic history that cannot be denied."

He denounced the denial of the Holocaust and anti-Semitic stereotyping, and criticized anyone who would threaten Israel's destruction.

Expounding on the plight of Palestinians, Obama said "it is also undeniable that the Palestinian people -- Muslims and Christians -- have suffered in pursuit of a homeland."

"For more than 60 years they have endured the pain of dislocation. Many wait in refugee camps in the West Bank, Gaza and neighboring lands for a life of peace and security that they have never been able to lead," he said. Watch Obama discuss the Israeli-Palestinian conflict »

"They endure the daily humiliations -- large and small -- that come with occupation. So let there be no doubt: The situation for the Palestinian people is intolerable. America will not turn our backs on the legitimate Palestinian aspiration for dignity, opportunity and a state of their own."

Obama also denounced Palestinian violence and the rejection by some of Israeli existence -- both seen by Israel as obstacles to peace. The president conjured the lessons of America's civil rights movement when he urged Palestinians to "abandon violence."

"Resistance through violence and killing is wrong, and it does not succeed. For centuries, black people in America suffered the lash of the whip as slaves and the humiliation of segregation," he said. "It was not violence that won full and equal rights. It was a peaceful and determined insistence upon the ideals at the center of America's founding."

The conflict, Obama said, needs to be seen from a larger perspective, not from the viewpoint of one side or another. And both sides must live up to the responsibilities of the moribund "road map" peace process, he said. Watch CNN's Christiane Amanpour on Obama's message of detente »

He added that the Hamas movement -- which controls Gaza -- and has some support among Palestinians must end violence and recognize past agreements. He also urged Arab states to no longer use the conflict to distract their peoples from other problems.

"The only resolution is for the aspirations of both sides to be met through two states, where Israelis and Palestinians each live in peace and security," he said.

Obama talked about the importance of confronting violent extremism, touching on the fight against the Taliban and al Qaeda after the September 11, 2001, attacks on the United States.

Emphasizing the fact that the United States entered Afghanistan by "necessity" and not "choice," he countered the stances of some "who "question or justify the events of 9/11."

"But let us be clear: Al Qaeda killed nearly 3,000 people on that day. The victims were innocent men, women and children from America and many other nations who had done nothing to harm anybody. And yet al Qaeda chose to ruthlessly murder these people, claimed credit for the attack and even now states their determination to kill on a massive scale. They have affiliates in many countries and are trying to expand their reach. These are not opinions to be debated; these are facts to be dealt with," he said.

Obama said the United States does not seek to keep its troops in Afghanistan or establish military bases there but needs to continue the fight against "extremists," with both military power and investment in the infrastructure and economy of Pakistan and Afghanistan.

"It is agonizing for America to lose our young men and women. It is costly and politically difficult to continue this conflict. We would gladly bring every single one of our troops home if we could be confident that there were not violent extremists in Afghanistan and Pakistan determined to kill as many Americans as they possibly can. But that is not yet the case," he said.

He addressed the conflict in Iraq, calling it unlike Afghanistan "a war of choice that provoked strong differences in my country and around the world."

"Although I believe that the Iraqi people are ultimately better off without the tyranny of Saddam Hussein, I also believe that events in Iraq have reminded America of the need to use diplomacy and build international consensus to resolve our problems whenever possible," he said.

He said the United States needs to help Iraq "forge a better future and leave Iraq to Iraqis."

"I have made it clear to the Iraqi people that we pursue no bases, and no claim on their territory or resources. Iraq's sovereignty is its own. That is why I ordered the removal of our combat brigades by next August. That is why we will honor our agreement with Iraq's democratically elected government to remove combat troops from Iraqi cities by July, and to remove all our troops from Iraq by 2012."

Speaking about prohibiting torture and the closing of the Guantanamo Bay, Cuba, detention facility, Obama talked about working on "concrete actions to change course" and correct abuses in the war on terror.

"Just as America can never tolerate violence by extremists, we must never alter our principles. 9/11 was an enormous trauma to our country. The fear and anger that it provoked was understandable, but in some cases, it led us to act contrary to our traditions and our ideals," he said.

Obama dwelled on the tensions over nuclear weapons between the United States and Iran and the "tumultuous history" between the countries.

He pointed to the U.S. role in overthrowing a democratically elected government during the Cold War era and Iran's role in hostage-taking and violence against U.S. troops and civilians since the Islamic revolution in 1979.

The president reiterated his desire to move forward with Iran on many issues, saying the "question, now, is not what Iran is against, but rather what future it wants to build."

"But it is clear to all concerned that when it comes to nuclear weapons, we have reached a decisive point. This is not simply about America's interests. It is about preventing a nuclear arms race in the Middle East that could lead this region and the world down a hugely dangerous path."

The United States and other Western nations have opposed what they believe are Iran's intentions to develop nuclear weapons.

Obama said that any nation, including Iran, "should have the right to access peaceful nuclear power if it complies with its responsibilities under the nuclear Non-Proliferation Treaty." He said such a "commitment" is at the treaty's core and "it must be kept for all who fully abide by it."

"And I am hopeful that all countries in the region can share in this goal," Obama said.

All About Barack Obama • Egypt • Islam • Al Qaeda