Who gets the dog or cat when a couple breaks up? A proposed reform of Spain’s legal seeks to recognise animals as “sensitive living beings” instead of mere objects as has been the case until now.

The change will pave the way for judges to declare joint custody of pets in divorce hearings just as they do with children.

Also read: With giant swabs and grumpy camels, Kenya hunts for next deadly virus

Until now custody of pets “has been the subject of controversy in our courts,” according to the proposed amendment to the legal code which still has to be approved by parliament.

The reform “sets out the criteria on which the courts must rely in deciding who to entrust custody of the animal, taking into account its well being”.

It will also give pet owners the right to compensation for “moral injury” if their animal is hurt by another person.

Also read: A whale chorus reveals how climate change may be shifting migration

The proposed change to the law was introduced in parliament on Tuesday by Spain’s ruling Socialists and Podemos, their far-left junior coalition partners. It is backed by all other parties, except the far-right Vox party.

Several other European nations including France, Germany and Switzerland, have already changed their legal code to recognise domestic animals as living beings.