RAMALLAH, West Bank, Aug. 2 — Secretary of State Condoleezza Rice, embracing an appointed Palestinian prime minister here in the West Bank, said Thursday that the United States still supported democracy in the Middle East. But she defended the American refusal to recognize the earlier, elected, Hamas-led government.

Standing next to Mahmoud Abbas, the Palestinian president, during a news conference here, Ms. Rice said, “We believe strongly in the right of people to express themselves and their desires, in elections.” But, she added, once elected, “ you have the obligation to govern responsibly.”

She said that the United States and other Western nations had been right to boycott Hamas and the elected Palestinian government. “You can’t have one foot in the path of terror and one foot in the path of politics,” she added.

Ms. Rice met with Salam Fayyad, the prime minister selected by Mr. Abbas after he ousted the Hamas-led government.