Secretary of State Condoleezza Rice swept through the Middle East this week, leaving behind striking images of a tough-minded diplomat navigating the shoals of the Israeli-Palestinian conflict and demanding that close U.S. allies Egypt and Saudi Arabia open up their repressive political systems.

But her remarks were tempered by pragmatism and an unwillingness to cross certain lines, possibly limiting the impact of her trip.

The centerpiece of her six-day tour, which ended Thursday after a meeting here with foreign ministers from the Group of Eight industrialized countries, was a speech Monday in Cairo pressing Middle Eastern countries to adopt democratic reforms. The venue was as important as the language: No secretary of state had ever pushed so strongly for reform in the capital of a friendly, if autocratic, Arab country.

The secretary declared that "the Egyptian government must put its faith in its own people" in upcoming elections. But U.S. officials acknowledged that the speech was carefully written to provide a poke, without undermining crucial cooperation from key Middle Eastern nations on counterterrorism, Arab-Israeli peace efforts and other issues.

Rice had riled the Egyptians by canceling a visit earlier this year to protest the continued jailing of a political activist. A day after Rice scrubbed the trip, Egyptian President Hosni Mubarak unexpectedly said he would permit opposition presidential candidates to face him in an election for the first time.

But the law implementing that change has been denounced as a sham by Mubarak's opponents, and Egyptian security forces have harassed and beaten democracy supporters. In her speech, Rice demanded that the attacks end so that demonstrators could gather "free from violence."

Two days later, her words seemed to have an effect. A few hundred activists marched through a Cairo neighborhood and denounced Mubarak. Riot police, who in the past have often outnumbered protesters, were absent.

While Rice spent about an hour meeting with some opposition leaders -- including Ayman Nour, who was jailed for six weeks earlier this year -- she drew the line at meeting with representatives of the Muslim Brotherhood, Egypt's largest opposition party, which has been banned from political activity for five decades. The Egyptian government has outlawed Islamic parties, and Rice said she would respect the laws of Egypt.

When a reporter pointed out that she had met with outlawed dissidents from Belarus and that President Bush had recently invited a defector from North Korea into the Oval Office, Rice replied, "I hardly think the Egyptian government is either the North Korean government or the Belarusan government."

Egypt and Saudi Arabia, however, are often seen as equally or even more repressive than governments that Rice has previously denounced as "outposts of tyranny."

Freedom House, a U.S.-based human rights group, annually ranks countries by the political rights and civil liberties afforded their citizens. Egypt received one of the worst combined ratings -- equal to Belarus, Iran and Zimbabwe, three countries on the Bush administration's tyranny list. Saudi Arabia is ranked even lower, as one of the world's most repressive governments -- along with Burma, North Korea and Cuba, the other three "outposts of tyranny."

The United States has virtually no relations with the countries on the tyranny list, making it easier for U.S. officials such as Rice to condemn their human rights records. Saudi Arabia is generally among the State Department's lowest-ranked countries in terms of human rights, religious freedom and human trafficking, but U.S. officials have avoided dwelling on those shortcomings.

In her speech, Rice mentioned three people who were jailed in Saudi Arabia for presenting officials with a petition calling for a constitutional system, but she did not raise the issues of Saudi religious repression and discrimination against women.

Rice's talks with Saudi officials later in the trip made the reason for her gingerly approach clear. The Saudi government continues to work closely with the United States. When the secretary emerged from the talks, Foreign Minister Saud Faisal cited a long list of issues they had discussed, including the Middle East peace process, the war in Iraq, the administration's support for Saudi Arabia's joining the World Trade Organization, cultural and business exchanges and the finalizing of plans to establish a high-level "strategic dialogue" between the two countries.

Egypt receives about $2 billion a year in economic and military aid from the United States. The aid is a continuing reward for its cooperation on Middle East peace, and U.S. officials have been reluctant to tie the aid to Egypt's political openness. Earlier this year, however, Deputy Secretary of State Robert B. Zoellick warned a visiting Egyptian cabinet minister that the United States would hold up $200 million in aid until Nour was released.

Rice began her trip with a visit to Israel and the West Bank, announcing Sunday that Israel and the Palestinian Authority had agreed to a set of principles for cooperating on Israel's withdrawal of settlers and troops from the Gaza Strip.

But that hopeful moment was overshadowed a day later when her spokesman unexpectedly issued a statement condemning the Palestinians for failing to combat militant groups, with language much stronger than Rice had used when she met with Palestinian officials. That helped set the stage for Israeli Prime Minister Ariel Sharon's rebuke of Palestinian Authority President Mahmoud Abbas on the security issue at their summit on Tuesday.

Secretary of State Condoleezza Rice listens to a discussion on the Middle East during a meeting of Group of Eight foreign ministers in London.