Futility Closet tells the story of a 16th century French attorney who was placed in an unenviable position by the "the authorities in Autun [who] asked him to advocate for the rats, which they put on trial in 1510 for eating the harvest of Burgundy":
In his defence, Chasseneux showed that the rats had not received formal notice; and, before proceeding with the case, he obtained a decision that all the priests of the afflicted parishes should announce an adjournment, and summon the defendants to appear on a fixed day.
At the adjourned trial, he complained that the delay accorded his clients had been too short to allow of their appearing, in consequence of the roads being infested with cats. Chasseneux made an able defence, and finally obtained a second adjournment. We believe that no verdict was given. -- Sabine Baring-Gould*, Curiosities of Olden Times, 1896
Speeches exhorting rats and other undesirables to leave a particular area were not uncommon in the Middle Ages and Renaissance, but this is the first case I've heard of in which they were given the right to a free legal defense. (By the way, of an earlier era had a sense of humor too and would have been ROTFL at Chasseneux's performance IMHO.)
According to The History of Human-Animal Interaction (which also mentions the clever Chasseneux):
In the 1994 article "The Law Is an Ass: Reading E. P. Evans' The Medieval Prosecution and Capital Punishment of Animals" (Society & Animals: Journal of Human-Animal Studies, published by the organization Psychologists for the Ethical Treatment of Animals), Piers Beirne described the practice in detail.
The article reviewed books on the subject by several authors, focusing on one written by E. P. Evans in 1906. Evans described 191 animal trials, mostly from the fifteenth through the seventeenth centuries. Most of the trials took place in France, Italy, and Germany. There are also a few historical records of trials in other European countries and in the United States, Canada, and Brazil. Animals were tried for a variety of offenses besides murder, mostly fraud and theft. Records show that many were tortured for confessions (just as humans were) prior to the trial. It is not clear how animal confessions were interpreted, considering that animals cannot speak human languages.
Criminal proceedings against animals were handled with the utmost seriousness by medieval legal authorities. Animals that harmed humans were considered servants of the devil because they had violated God's directive in the Bible that humans should have dominion over animals. A particular Bible verse, Exodus 21:28, was often cited as the grounds for executing an animal convicted of murder: "If an ox gore a man or a woman that they die, then the ox shall be surely stoned, and his flesh shall not be eaten." The penalties for offenses less serious than murder matched those given to humans for the same types of crimes.
Evans listed a variety of domestic and wild animals, as well as rodents, sea creatures, birds, and insects, that were tried at various times by government or church courts. Those that could not be physically brought to court were tried in absentia. In general, only the larger domestic animals, such as pigs, bulls, cows, horses, sheep, and dogs, actually appeared in court and were subjected to punishments. A few animals were found innocent or granted pardons or reprieves by authorities. Many wild animals found guilty by church courts were excommunicated (exiled from the church).
The vast majority of criminal defendants were pigs, probably because farmers allowed them to roam free much of the time. In 1386 a pig accused of murdering an infant was tried and convicted by a court in Falaise, France. The pig was hanged at the gallows by the village hangman. Her six piglets were charged with being accessories to the crime but were acquitted "on account of their youth and their mother's bad example."
A lawyer could establish his reputation by performing well in animal trials. In France in the early 1500s, a lawyer named Bartholomé Chassenée was appointed to represent some rats that had eaten and destroyed some barley (a felony). Chassenée used a series of clever legal maneuvers to delay the trial as long as possible. At one point he convinced the judge that it was too dangerous for his clients to come to court on the appointed day because of the many cats in the neighborhood. Chassenée became famous throughout France for his excellent legal skills.
I believe that many of these cases were extensions of the practice of deodand, which also pertained to inanimate objects:
Under this law, a chattel (i.e. some personal property, such as a horse or a hay stack) was considered a deodand whenever a coroner's jury decided that it had caused the death of a human being. In theory, deodands were forfeit to the crown, which was supposed to sell the chattel and then apply the profits to some pious use. (The term deodand derives from the Latin phrase "deo dandum" which means "to be given to God." In reality, the juries who decided that a particular animal or object was a deodand also appraised its value and the owners were expected to pay a fine equal to the value of the deodand. If the owner could not pay the deodand, his township was held responsible.
Arguments for the culpability of a particular animal or object were taken quite seriously because they determined the fine imposed on the owner.
Illustration from Gode Cookery.com
*Sabine Baring-Gould was an Anglican minister who also wrote "Onward Christian Soldiers" and a famous book about werewolves.