England vice captain Ben Stokes was fined and given a demerit point on Saturday for swearing at a fan as he walked off the field after getting out during the final cricket test against South Africa.

The International Cricket Council said Stokes was charged under its code of conduct for “use of an audible obscenity during an international match.”

The star allrounder was fined 15 percent of his match fee. It was his first demerit point in the last two years. Players who accumulate four disciplinary points in a two-year period are banned.

England's bowler Ben Stokes during day two of the fourth cricket test match between South Africa and England at the Wanderers stadium in Johannesburg, South Africa, Saturday, Jan. 25, 2020. (AP PhotoThemba Hadebe)

England's bowler Ben Stokes during day two of the fourth cricket test match between South Africa and England at the Wanderers stadium in Johannesburg, South Africa, Saturday, Jan. 25, 2020. (AP PhotoThemba Hadebe)

Stokes accepted the charge and there was no need for a formal hearing, the ICC said.

The incident happened on the first day's play at the Wanderers on Friday.

Stokes had been dismissed for just 2 and was heading off the field and up the players' tunnel when he was heard on live TV coverage hurling two expletives in the direction of a fan.

Stokes, clearly angered at something that was said to him, shouted back “come and say it to me outside the ground” before using the two expletives.

The 28-year-old Stokes apologized for the incident and said he had been subjected to “repeated” verbal abused by the crowd as he walked off but shouldn't have reacted the way he did.

The England team said members of its backroom staff had also been verbally abused by the Johannesburg crowd on the opening day and asked for extra security for the remainder of the test.

England leads the four-match series 2-1 and can clinch it with just a draw in the final test. The tourists are on course for victory after making an imposing 400 all out in their first innings.

Stokes had just won back his reputation by being crowned the 2019 world player of the year. That was in recognition of his stellar year, when he was pivotal in helping England win the Cricket World Cup and also played one of the most memorable test innings to make a century and snatch victory from almost-certain defeat in an Ashes test against Australia.

But his apparent challenge to the fan to have a fight outside the stadium dragged up a checkered disciplinary past.

Stokes faced criminal trial in Britain over a street brawl outside a nightclub in late 2017. He was acquitted after he said he got involved to defend a gay couple from homophobic abuse. He was still fined and banned by the England and Wales Cricket Board for bringing the game into disrepute.

Stokes was also sent home from an England youth team tour early in his career for breaches of discipline.

More AP sports: https://apnews.com/apf-sports and https://twitter.com/AP_Sports