Serena Williams “went too far” with her controversial rant at an umpire during the US Open final, according to Roger Federer.

Williams received a code violation for coaching, a penalty point for racquet abuse and a game penalty for calling the umpire a “liar” and a “thief” during her defeat by Naomi Osaka, with her outburst overshadowing the biggest win of her opponent’s career.

“I feel like Serena should have walked away,” Federer told Britain’s Sunday Times newspaper.

“She did, but she went too far. She should have walked earlier.”

Nevertheless the Swiss star did have some sympathy for Williams, adding: “The umpire maybe should not have pushed her there. It’s unfortunate, but an incredible case study.”

Osaka’s 6-2, 6-4 win over Williams quickly became infamous for the American’s flare-up in the second set.

Williams, 37, was given a first code violation after umpire Carlos Ramos judged her coach Patrick Mouratoglou to be coaching – something that is prohibited under Grand Slam rules – as he watched the match courtside.

Mouratoglou later admitted he had indeed been coaching as he criticised the rule.

Following the code violation, Williams told Ramos she would “never cheat to win and would rather lose”.

‘What’s the problem with the catsuit?’

In the Sunday Times interview, Federer also spoke about the issue of female players’ on-court attire.

In September it was announced that Williams would be banned from wearing her black catsuit at future French Opens, with the tournament set to introduce a stricter dress code.

Meanwhile, at the US Open, France’s Alize Cornet received a code violation for changing her shirt on court.

“What was the problem with taking the shirt off or the catsuit?” said Federer, a 20-time Grand Slam singles champion.

“Serena has worn crazier stuff in the past. Guys have worn crazier stuff. For me it was all a bit of nonsense.

“I was totally on the women’s side. Leave them alone.