Matt Joyce apologized shortly before MLB announced his suspension. (Harry How/Getty Images)

Oakland Athletics outfielder Matt Joyce has been suspended two games without pay for directing anti-gay slurs at a fan during Friday night’s 8-6 loss to the Los Angeles Angels of Anaheim. ESPN first reported the news of the suspension on Saturday.

In addition, MLB has ordered Joyce to volunteer with PFLAG, an LGBTQ-friendly outreach organization.

Shortly before the suspension came down, Joyce took to Twitter to apologize for his actions in a series of posts:

“In regard to last night’s incident, I first and foremost want to sincerely apologize to the fans, the Oakland A’s, MLB and the most importantly the LGBTQ community for my comments and actions. A fan yelled vulgar and obscene words about me and my family and I let my frustrations and emotions get the better of me. I am beyond sorry for the inappropriate language that I used and understand and agree that those words should NEVER come out of someone’s mouth no matter the situation. Anyone who knows me will tell you that incident it is not reflective of me as a person, how I treat others, how I live my life and that those hurtful words are not my views. I fully support and hope to help the LGBTQ community with their efforts in being treated fairly and intend to let my actions speak louder than anything more that can be said about this truly regrettable moment.”

The exchange, which occurred at Angel Stadium as Joyce headed to the dugout after grounding out to end the eighth inning, came to light after Associated Press photographer Mark J. Terrill overheard it.

“It’s just one of those things that fans kind of get into the game. Obviously, we’re pretty frustrated on our side and I had just hit a ball hard and had [Angels first baseman C.J. Cron] make a good play,” Joyce, who played for the Angels in 2015, told reporters afterward. “I was walking back to the dugout and just had a fan yell some vulgar and obscene words. For me it just wasn’t the right time to say some stuff like that. I fired back and obviously as soon as you fire back you regret saying anything, because it’s just not worth it.”

Later Saturday, the A’s had announced that MLB has begun an investigation of the incident.

“We have been in contact with the commissioner’s office, as this is a workplace code of conduct issue,” A’s spokeswoman Catherine Aker told the Associated Press. “They have opened an investigation.”

In May, Blue Jays center fielder Kevin Pillar was suspended two games for directing a homophobic slur toward Atlanta Braves pitcher Jason Motte, with the league calling it a violation of MLB’s workplace code of conduct.

More baseball:

Orioles seem to be planning for neither the present nor the future

With deadline trade for Sonny Gray, the Yankees are back again

Dodgers were already baseball’s superteam — then they traded for Darvish

More MLB | Nationals news | Post Sports | Post Sports on Facebook