Stokes said he intervened because Ali and his friend Ryan Hale had directed alleged homophobic abuse at gay men William O’Connor and Kai Barry as they walked away from Mbargo nightclub.
He could not recall what was said, but “I am very clear that the words that were used were homophobic”, he told the court.
Corsellis asked Stokes if he had a “significant memory blackout” from the night in question.
The sportsman replied: “You could say that, yes.”
‘Throwing multiple punches’
Stokes and other England cricketers, including Alex Hales, went out celebrating beating the West Indies in a match in Bristol on September 24.
Stokes said he would have had a bottle of beer after the match, two or three pints at the hotel, five or six vodka and lemonades and then “potentially had some Jaegerbombs” in Mbargo.
The prosecutor asked: “You don’t really remember significant parts of this incident, for example knocking Mr Ali out? Is that because you were really very drunk?”
Stokes replied: “No.
“I think the whole incident would have been clouded because it was such… there was a lot of people around… a lot of shouting.
“I don’t remember every little detail.”
He added: “It’s clearly in my statements that I admit to throwing multiple punches.”
Stokes insisted that after he told Ali to stop verbally abusing O’Connor and Barry, Ali told him to shut up “or I’ll bottle you”.
The cricketer told the court he had not mocked or been homophobic towards Barry and O’Connor when talking with them outside Mbargo, where he and fellow cricketer Hales had been refused re-entry.
Looking at security camera footage from outside the nightclub, Stokes said it was not possible to tell if he was angry.
“I might just be looking at the night sky,” he said.
Corsellis asked: “Who were you speaking to when you were looking at the night sky?”
Stokes replied: “God?”
Corsellis said: “When you saw Mr Ali had a bottle and that he was threatening to Alex Hales and hit Kai Barry on the shoulder, you decided to get involved.
“After you had been on the ground and he (Ali) disarmed you thought, ‘I am going to show you what violence is’ and you thought, ‘I am going to retaliate and I am going to punish you and hit you out of revenge’. Is that not the truth?”
Stokes replied: “Absolutely not.”
Corsellis asked: “Is it what we see on the footage — an angry man who has lost all control?” Stokes again replied: “Absolutely not.”
Ryan Hale was also charged with affray but formally found not guilty on Thursday after the judge dismissed the case against him.
Stokes has finished giving evidence as the trial continues.