Ayatollah Ali Khamenei, Iran's supreme leader, was recovering at a government hospital in Tehran on Monday after undergoing prostate surgery, state media reported.

The Associated Press reported his doctors as saying the 75-year-old cleric was resting after the surgery. Khamenei, who has final say on all state matters and has been Iran's top leader since 1989, was reported to be in "good condition."

President Hassan Rouhani visited the supreme leader in hospital after the procedure and later released a statement saying that Khamenei's condition is "very good and hence, the people should not be worried."

Rouhani said he had offered to cancel his attendance at a regional summit in Tajikistan but that Khamenei had convinced him to proceed with the planned trip.

The official IRNA news agency described the operation as "routine" and said it was successful, without giving details on what had prompted it or the underlying medical condition.

Head of Khamenei's medical team, Dr. Ali Reza Marandi, told state TV that the procedure took less than half an hour and was performed under local anesthesia. He said Khamenei will need three to four days of rest.

Earlier in the day, state TV aired a brief footage of Khamenei before the surgery in which he asked people to pray for him.

"There is no room for concern, but this does not mean that they — the people — should not pray," Khamenei said.

Khamenei was a close ally of the late Ayatollah Ruhollah Khomenei who led the 1979 Islamic Revolution and was later Iran's supreme leader until his death in 1989. He served as Iran's president for eight years before becoming the supreme leader in 1989 and has proved a powerful defender of the clerical rule established by his predecessor.

Khamenei has kept Iran on a firmly anti-U.S. path, pushing ahead with its nuclear ambitions despite international pressure and sanctions. At the same time, Iran sought to extend its influence in the Middle East through its ally Syria and Islamic militant groups despite attempt by U.S.-backed Arab governments to contain Iran.

In 2009, Khamenei thwarted the movement in support of a reformist presidential candidate, Mir Hossein Mousavi, and when hundreds of thousands rose up around the country marching in the streets, some overtly denouncing him, he stepped forward to crush the protests.

Under the Iranian system, the president and members of parliament are elected in nationwide balloting but an undisputed clerical hierarchy controls councils that approve legislation and candidates running for office. The clerics are also in charge of the powerful judiciary and are tightly linked to the paramilitary Revolutionary Guard force.

Khamenei has seen four presidents take office during his leadership. Hard-line former President Mahmoud Ahmadinejad, who once was seen as being firmly within the theocracy's fold, later rebelled and challenged Khamenei's authority.

More recently, Khamenei has lent support to the talks between Iran and the six world powers on Tehran's controversial nuclear program and the breakthrough interim agreement those talks produced last November.

But he has also expressed doubts the talks will lead anywhere. Last month, Khamenei said the United States had only grown more hostile to Iran since the talks began, and that there was no point in holding direct negotiations with Washington.

The U.N.'s nuclear agency is trying to investigate allegations that Iran secretly worked on nuclear weapons — something Tehran denies, insisting its nuclear program is for peaceful purposes only, such as power generation and cancer treatment.

Khamenei has backed the reformist Rouhani, who took office in August 2013, and his efforts to stabilize the national currency and halt inflation. But the government has a long way to go to deliver on promises of economic growth.

Khamenei earlier this year said the priority for Iranians is to make their economy immune to outside pressures. He has called U.N. and Western sanctions imposed over Iran's nuclear program a "full-fledged economic war" on his country and has ordered the government to create an "economy of resistance" to counter the measures.

"If a nation is not strong, the world's extortionists will extort from it, insult it and if they can, they will trample on it," Khamenei said in March, in his annual speech for the Persian New Year, Nowruz. "If a nation doesn't become strong, it will be bullied by others."

Most Iranian state TV and radio channels kept broadcasting their regular programs on Monday, an indication that the situation was business as usual.