Army chiefs put military vehicles on the streets of Harare and placed veteran leader Mugabe, 93, under house arrest, before he resigned on Tuesday.
Many Zimbabweans celebrated the end of Mugabe's 37-year rule, but fear the new government under President Emmerson Mnangagwa could also be an authoritarian regime.
"Actions by the Zimbabwe Defence Forces to stop the usurping of power by those close to former president Robert Mugabe are constitutional," state-run ZBC media reported the court as saying.
In an apparent reference to Mugabe's wife Grace and her supporters, it said the court ruled that the takeover was "to ensure the non-elected individual do not exercise powers that can only be exercised by (those) elected".
Grace was alleged to have positioned herself to be Mugabe's chosen successor, prompting the military to intervene and usher in their preferred candidate Mnangagwa.
He used his inauguration speech to pay tribute to the increasingly frail Mugabe, describing him as one of the "founding fathers of our nation".
Alongside another court ruling that Mugabe's earlier sacking of Mnangagwa as vice president was illegal, Human Rights Watch questioned the courts' independence.
"Two incredible judgements," Dewa Mavhinga, southern African director of HRW, wrote on Twitter. "Strange, captured judiciary?"
(This story has not been edited by NDTV staff and is auto-generated from a syndicated feed.)
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections.