WASHINGTON  President Obama on Friday put Egypt’s embattled leader, Hosni Mubarak, on notice that he should not use his soldiers and the police in a bloody crackdown on the protests in Egypt, edging away from a close American ally whose cities have erupted in protest.

Addressing the nation from the White House after a day of rage across Egypt, Mr. Obama said he called Mr. Mubarak and told him “to refrain from any violence against peaceful protesters” and to turn a “moment of volatility” into a “moment of promise.” Declaring that the protesters have universal rights, he said, “The United States will continue to stand up for the rights of the Egyptian people.”

Mr. Obama’s brief remarks came as a blunt reply to Mr. Mubarak, who spoke to his own people just one hour before and mixed conciliation with defiance as he dismissed his government but vowed to stay in office to stabilize Egypt.

Faced with images of riot police officers using tear gas and water cannons against protesters, the Obama administration has moved from tentative support to distancing itself from Mr. Mubarak, its staunchest Arab ally, saying it would review $1.5 billion in American aid and warning him that he must confront the grievances of his people.