The zoo statement said the enclosure met international standards and said "this kind of accident is rare, unpredictable and unusual".
Africa Live: More on this and other stories
The statement went on (in French) to point out two other recent incidents in the US:
In June an alligator killed a two-year-old boy at Walt Disney World in Florida
In May, zookeepers killed a gorilla at Cincinnati Zoo after a three-year-old boy fell into its enclosure.
Phyllis Lee, Scientific Director of the Amboseli Trust for Elephants, says that targeted throwing of stones and branches by elephants is very unusual.
"It can happen when elephants are frustrated or bored. In my opinion, it's unlikely the elephant was directly targeting the girl - but exhibiting frustration. You can't predict what animals in captivity will do."
The moments after the girl was struck at Rabat Zoo on Tuesday were filmed by a bystander and uploaded onto YouTube.
The video shows the elephant waving its trunk behind a fence and swerves round to show a stone on the ground.
Metres away people are gathered around the girl, holding her head and stroking her leg.
Credit: The BBC