Nick Kyrgios of Australia

Controversial Australian Nick Kyrgios snapped "that's just crap!" at the umpire on Wednesday as he earned his third code violation in a week when he smashed away a loose ball and nearly hit a line judge.

Kyrgios, 20, was left fuming by the decision at the climax of the second set as he slumped from a dominant start to a 1-6, 6-4, 6-4 defeat by Kei Nishikori in the Shanghai Masters second round.

Kyrgios also picked up a code violation for offensive language in the first round and was later fined $1,500 for the audible obscenity as he veers dangerously close to triggering a four-week ban.

The Australian was handed a suspended ban in August for making a sexual slur during a Rogers Cup match about the girlfriend of his opponent at the time, Stan Wawrinka.

But he will have to serve the ban if he picks up $5,000 in fines before February 24. Tennis officials will review the latest incident before deciding whether they will fine Kyrgios again.

Tuesday's flare-up was not the first row between Kyrgios and umpire Mohamed Lahyani, after the Australian had to deny calling the official "dirty scum" during a match at this year's Wimbledon.

At the end of the second set in Shanghai, a frustrated Kyrgios slapped away a bouncing ball with a huge backhand which nearly hit the central line judge, who had to take evasive action.

"This for me is too dangerous, you hit it so hard," Lahyani said as they argued during the changeover.

Kyrgios protested: "I didn't even hit anyone but it's unsportsmanlike? The ref wasn't even close to it... well let's just look at the tape because that's just crap."

Kyrgios repeatedly sparred with Lahyani and at one point shouted: "Water bro, water!" at a startled ball boy as a quietly impressive win for Nishikori was overshadowed by histrionics.

Australian legend Rod Laver was courtside and taking pictures of the action as the match unfolded. Kyrgios also picked up a code violation at last week's Japan Open for hitting a ball into the roof.
Source: AFP