Mubarak issued a decree giving Nazif executive power until he returns to Cairo after consulting the constitution, the official news agency reported.
"President Hosni Mubarak will undergo a surgical operation to extract the gall bladder in Heidelberg University hospital on Saturday," MENA said, adding that a medical examination on Friday confirmed "chronic infections in the gall bladder."
The agency published the president's decree handing power to Nazif until he returns to work. "Prime Minister Dr. Ahmed Mahmud Mohammed Nazif assumes all the prerogatives of the president of the republic according to Article 82 of the constitution until he resumes his responsibilities," the decree said.
State television announced that Mubarak, 81, had suffered "gall bladder pain" while in Germany for talks on Thursday with Chancellor Angela Merkel.
It said the president was accompanied by his wife Suzanne Mubarak and members of his family. Mubarak's health is usually a taboo subject in the country he has ruled since 1981, fuelling regular rumours on the subject.
In 2007, speculation snowballed to the extent that the president was forced to make an unscheduled public appearance to put a rest to the rumours.
A year later, Ibrahim Eissa, editor in the chief of the independent daily Al-Dustur, was sentenced to two months in prison for writing about Mubarak's health. He later received a presidential pardon.