Charges have been dropped against a 41-year-old Nigerian man who named his dog after President Muhammadu Buhari.
Joachim Iroko, a market trader also known as Joe Fortemose Chinakwe, was arrested in 2016 accused of conduct likely to cause a breach of the peace.
A judge in south-west Ogun state found the prosecution had failed to substantiate the charges against him.
The arrest sparked nationwide outrage. Critics accused the police of stifling constitutionally guaranteed freedoms.
At the time, presidential spokesman Garba Shehu said that Mr Buhari must be having a good laugh about the story and that anyone linking him to the dog incident was displaying their ignorance.
Speaking to Nigeria's daily Vanguard newspaper after the ruling, Mr Iroko said he had been vindicated and thanked all those who had spoken out on his behalf.
Mr Iroko's lawyer said the prosecution had repeatedly failed to present witnesses and that the complainant was also absent.
The man who lodged the complaint in August 2016 was reported to be a neighbour.
Mr Iroko walked his pet - with the name Buhari painted on both flanks - in an area where support for the president was high, police said at the time.
Officers said they were worried the move could antagonise people, though he insisted it was meant as a compliment and that people had misunderstood him. Mr Iroko said he named his dogs after his role models, and that others had been called Nelson Mandela and Obama.
"I named my beloved pet dog Buhari, who is my hero....My admiration for Buhari started far back when he was a military head of state."
He later told local media he had received death threats over the perceived slight.
Have your say
More World Headlines
- Lion Air crash: Victim's fiancée takes wedding photos alone
- UK closer to delivering Brexit - May
- UN lifts nine-year Eritrea sanctions
- South Africa minister resigns weeks after sex video scandal
- Brexit: Theresa May to face cabinet showdown over deal
- Trump finally appoints new ambassador to Saudi Arabia
- Over 300,000 Congolese refugees forced to leave Angola
- 10 students die in suspected arson at Ugandan boarding school
- CNN sues Trump, top White House aides for barring Acosta
- California wildfires: Death toll reaches grim milestone
- Final school hostages freed in Cameroon
- Raging Californian fires kill 25
- Study finds 'huge' fall in FGM rates among African girls
- Trump, Macron may clash on European defense in Paris talks
- Death toll from Somalia hotel attack rises to 39