Saudi Arabia's King Salman bin Abdulaziz, 86, left hospital on Sunday following a colonoscopy last week, the royal court said in a statement on state media.
Saudi TV ran a video clip showing the monarch walking slowly using a cane as he left King Faisal Specialist Hospital in the city of Jeddah, where he was admitted on the evening of May 7.
An entourage kept close and his son, Crown Prince Mohammed bin Salman, the kingdom's de facto ruler, appeared in the clip.
King Salman, the custodian of Islam's holiest sites, became ruler of the world's top oil exporter in 2015 after spending more than 2-1/2 years as the crown prince and deputy premier.
He underwent bladder surgery in 2020 and had the battery of his heart pacemaker replaced in March.