Germany's highest court has ruled that authorities must allow people to be entered in official records as something other than male or female.

The Federal Constitutional Court published its ruling Wednesday in the case of a person who had an application rejected to have their entry in the birth register changed from "female" to "inter/diverse" or "diverse." Officials rejected it on the grounds that the law only allows for children to be registered as male or female, or for the gender to be left blank.

The court said that the law protects sexual identity and "the sexual identity of those people who can be assigned neither to the male nor the female sex is also protected."

The government has until the end of 2018 to draw up new rules.