Daniil Medvedev said he was working to do “better next time” after his middle-finger gesture angered the crowd during his third round match at the US Open on Friday.

The Russian fifth seed received a code violation for angrily snatching the towel from a ballperson, threw his racquet and then covertly raised his middle finger next to his head as he began to walk.

The incident was not seen by chair umpire Damien Dumusois but was caught on television and shown on video replay inside Louis Armstrong Stadium.

“It was tough. I was in the heat of the moment and started losing the momentum. I don’t really remember but I paid for it the whole match after,” said Medvedev, who was roundly booed by supporters after a fired-up post-match interview.

“I want all of you to know, when you sleep tonight, I won because of you. The energy you gave. The more you do this, the more I win,” he said in the wake of a 7-6 (7/1), 6-4, 7-6 (9/7), 6-4 win over Feliciano Lopez.

Medvedev said he apologised to the Spaniard and his coach after the match, insisting his meltdown was in no way related to his opponent.

Asked whether the New York crowd would forgive him after qualifying for the last 16, where he will meet German qualifier Dominik Koepfer, Medvedev replied he wasn’t sure.

“What I can say is that I’m working on myself and hopefully I will be better next time,” he said.