The long-running legal battle over who owns the royalties to the famous "monkey selfie" has been settled.
David Slater, the photographer whose camera was commandeered by a crested black macaque, has agreed to donate 25 per cent of the royalties generated by the photos with animal charities dedicated to protecting the monkeys' natural habitat.
The agreement brings to an end to a dispute which originated in 2011 when Mr Slater travelled to Sulawesi, Indonesia, and spent a week taking pictures of macaques.
At one point he mounted the camera on a tripod and one of the monkeys started pressing the shutter button.
The popularity of the pictures triggered legal action after Mr Slater asked Wikipedia to take down one of the pictures which it had published without his permission.
Wikipedia refused, claiming the copyright belonged to the monkey.
Then despite the US Copyright Office ruling that animals could not own copyright, an American charity, People for the Ethical Treatment of Animals (Peta), entered the fray.
It sued Mr Slater in 2015, arguing that the copyright belonged to one of the macaques, Naruto.
In a bizarre hearing in San Francisco, lawyers argued not only whether a monkey could claim copyright but whether Naruto was even the correct monkey.
Mr Slater, who said he made around £100 every few months from image sales of the grinning monkey, was confronted with legal bills running into thousands of pounds.
Facing financial ruin he even considered giving up wildlife photography and becoming a tennis coach or dog walker instead.
Finally, agreement has been reached.
In a joint statement, Peta and Mr Slater said that the case raised "cutting edge issues" about the legal rights of animals.
"We must recognise appropriate fundamental legal rights for them as our fellow global occupants and members of their own nations who want only to live their lives and be with their families."
Lawyers for the group and Mr Slater asked the San Francisco-based 9th US Circuit Court of Appeals to dismiss the case and throw out a lower court decision that said animals cannot own copyrights.
Mr Slater had argued that his company, Wildlife Personalities Ltd, owns worldwide commercial rights to the photos, including the now-famous selfie of the monkey's toothy grin.
US District Judge William Orrick said in a ruling in favour of Mr Slater last year that "while Congress and the president can extend the protection of law to animals as well as humans, there is no indication that they did so in the Copyright Act." The 9th Circuit was considering Peta's appeal.
The lawyers notified the appeals court on August 4 that they were nearing a settlement and asked the judges not to rule. A three-judge panel of the 9th Circuit heard oral arguments in the case in July.