Landon Donovan and the San Diego Loyal soccer team he coaches walked off the pitch in protest Wednesday night after a member of the Phoenix Rising allegedly directed a homophobic slur at Collin Martin, a gay player.

The incident in the second-tier USL Championship game occurred just before halftime in San Diego and came a week after the Loyal forfeited a match when LA Galaxy II player Omar Ontiveros allegedly called the Loyal’s Elijah Martin the n-word. Ontiveros was suspended by the league and cut by the team.

In an interview with The Washington Post on Thursday, Collin Martin said he had an extended exchange with Junior Flemmings, who then "called me a bati boy, which I knew, for a lack of a better word, meant ‘faggot.’ "

Martin, who is from Chevy Chase, Md., and formerly played for D.C. United, said: "He was in the ref’s ear [about a yellow card against a Phoenix player]. I told him to stop complaining. He used some bad language toward me four or five times, which I can deal with, no problem.

"I then had a conversation with another one of their players. I said, ‘I can’t believe how disrespectful this guy is.’ "

Flemmings, Martin said, “got upset I was talking to his player, and that’s when he said what he did. He escalated it to get under my skin.”

Martin said he approached the referee to share what was said, but the referee thought Martin was insulting him and showed a red card. The card was later rescinded and Flemmings was not punished.

Flemmings remained in the game when the second half began. Loyal players took a knee, then walked off, forfeiting a match in which they were leading 3-1,and ending their chances of advancing to the playoffs.

“I lost it because I know what this team has gone through,” Donovan said Wednesday. “I know how hard it was for them to even take the field tonight, given everything that happened, and then for it to happen again a week later was just devastating for me.”

Flemmings said his teammates would back him up in a statement in which he said, “I respect all of my opponents equally.” He went on to say that he had been “mauled and ridiculed online with no opportunity to defend myself,” adding, “I stand in solidarity with the LGBTQ+ movement.”

Martin called Flemmings’s denial “a joke. If he would own up to it, I am the last one to crush the guy. There is so much education to be done. If he understood the impact of that word, he could be a big role model for kids in sports. I hope he considers that and learns his lesson.”

The USL Championship said in a statement Wednesday that the incident is under investigation. “Foul and abusive language of any type has absolutely no place in our society and will not be tolerated in USL matches,” it said.

On Thursday, the league’s parent organization, the United Soccer League, announced that it intends to “institute increased sanctions for players and coaches found to have used foul and abusive language.” The United Soccer League also said it is partnering with the Institute for Sport and Social Justice to “provide leaguewide training and education for all staff and players.”

Donovan, who is also an executive vice president for the Loyal, said his players “went through a really hard incident last week in the LA match and we made a vow to ourselves, to our community, to our players, to the club, to USL, that we would not stand for bigotry, homophobic slurs, things that don’t belong in our game.”

Martin revealed that he is gay during June — Pride Month — in 2018, announcing on social media what he said his family, friends and teammates had long known.

“Representation is huge,” Martin told The Post at the time. “Having role models in any workplace in any setting in life is important. The fact is, there aren’t enough professional athletes that are good role models for kids that are growing up that are gay.

“People need to know that it doesn’t matter what sexuality you are, how old you are, what race. It doesn’t matter. You’re going to be received well on a team as long as you’re a good teammate and do your job every day.”

Donovan said that he and Loyal players regretted not acting last week after the racial incident and vowed to make a statement. So, Wednesday night, they had approached the Phoenix team and planned to stop the game in the 71st minute, the time when Elijah Martin was allegedly targeted, holding up a banner saying “We will speak, we will act.” After halftime, they decided to act if Flemmings was still on the field.

Collin Martin said he wanted to continue the game.

But he said his teammates told him, " ‘No, we are not going to play.’ They were really all in support of me. As a player, it becomes overwhelming when a decision is made on behalf of you.

“I understood that was the right decision for the club, and I was really proud of it. In the heat of the moment, I was tearing up a little bit just because I was so upset for the guys we couldn’t finish the game.”

More soccer coverage from The Post: