Bayern Munich defender Lucas Hernandez will not go to a Spanish jail for violating a restraining order in 2017 after a Madrid court on Wednesday accepted an appeal by the French player.

"We consider that the appeal should be upheld and the order to enter prison suspended," the court said in a statement.

The suspension of the sentence will be for a period of four years as long as Hernandez does not commit any further crime and the payment of a fine of 96,000 euros ($111,000), the court said.

Bayern Munich welcomed the court's decision.

"We'd assumed that exactly this result would come about. We are all happy that it turned out the way it did," club CEO Oliver Kahn told ARD.

With Bayern head coach Julian Nagelsmann isolating at home after testing positive for Covid-19, his assistant trainer Dino ToppMoeller said Hernandez had been relaxed in training.

"We're all a bit relieved, although it's not been a topic within the team," Toppmoeller added before Wednesday's German Cup second-round match at Borussia Moenchengladbach.

Hernandez, a World Cup winner with France in 2018, was arrested four years ago in Spain for violating a court order banning him from contacting his partner after a violent altercation between the pair.

He and his partner, Amelia Lorente, were both convicted of domestic violence in February 2017.

She hit and scratched Hernandez, while the player hit her in the ribs, back and face, according to the court ruling at the time.

Bayern Munich and France defender has avoided a prison sentence in Spain
Bayern Munich and France defender has avoided a prison sentence in Spain AFP / Christof STACHE

Neither made a complaint against the other, but both were charged by Spain's public prosecutor.

The then-Atletico Madrid player and his girlfriend were each sentenced to 31 days of community service. They were also ordered not to see each other for six months.

Four months later though, Hernandez was arrested at a Madrid airport.

He was in the company of Lorente, who was not arrested as her own restraining order had not yet been formally served. They were returning to Spain after marrying in the United States. The couple have since had a son.

Hernandez was sentenced in 2019 to six months in prison, a sentence he had appealed. It was the rejection of this appeal, on the grounds that he was a repeat offender, that led to this summons before a court in Madrid.

The court said Wednesday it had accepted Hernandez's appeal based on his current family situation and the low probability that he would commit a crime again.

"It cannot be ignored that the person who he was not supposed to approach consented to be approached," the court said in a reference to Lorente.

The court also pointed out that Hernandez lives with Lorente and their son and "there have been no new incidents between the couple."

"There are no records of him having committed any new crimes, which can be taken into account to conclude that it is not necessary for the sentence to be carried out to prevent him from committing another crime," the court added.

Hernandez became the most expensive player in Bundesliga history when he joined Bayern from Atletico in 2019 for 80 million euros.

Bayern currently sit at the top of the Bundesliga and are the top of Group E in the Champions League.