Milwaukee Brewers pitcher Josh Hader apologized late Tuesday for being "immature and stupid" after admitting to racist, misogynistic and homophobic comments on Twitter years ago — tweets that resurfaced just as he was playing in his first MLB All-Star Game.

After Tuesday night's game at Nationals Park in Washington, Hader, 24, returned to the National League clubhouse to find his cellphone "blowing up" about the tweets, which he said were written when he was 17. He made his professional debut with the Brewers last year after first being drafted by the Baltimore Orioles in 2012.

"I was in high school," said Hader, who grew up in Maryland. "We're still learning who we are in high school. You live and you learn. This mistake won't happen again."

"I'm deeply sorry for what I said ... it doesn't reflect any of my beliefs now," he added.

Josh Hader addresses the tweets that surfaced during the game pic.twitter.com/Zzh6uS2frH — Ryan Fagan (@ryanfagan) July 18, 2018

Screenshots of some of the tweets from 2011 and 2012 were shared on social media before Hader later deleted his Twitter account, which was verified.

Hader didn't specify what he might have written, but the tweets that were captured included the repeated use of the N-word, disparaging remarks about women and gays, and the words "KKK" and "white power."

As the tweets appeared to go viral during the All-Star Game, Hader's friends and family at the ballpark were given blank jerseys and gear to swap with, according to reports.

Hader, a rising star in the league known for his powerful left-handed fastball, told reporters Tuesday that he just never deleted the old tweets, but that some of them may have been rap lyrics.

"I really don't know exactly what's all out there," he said.

Hader added that he wanted to talk with his teammates and was willing to face possible discipline from the MLB.

The league said in a statement Wednesday afternoon that it would require Hader to undergo "sensitivity training" and participate in its diversity and inclusion initiatives.

"Hader took the necessary step of expressing remorse for his highly offensive and hurtful language, which fails to represent the values of our game and our expectations for all those who are a part of it," the statement said.

Brewers General Manager David Stearns also said Hader's past comments are "inexcusable," no matter how old they are.

Stearns did not say in his statement if Hader would be disciplined by the team, but that "we will continue to work through this issue with Josh as we prepare to resume games after the break."

The league has ordered sensitivity training before.

Earlier this year, Astros first baseman Yuli Gurriel completed such a program after he made a racist gesture toward Dodgers pitcher Yu Darvish during last year's World Series. He was also suspended for five games.

In 2006, Chicago White Sox manager Ozzie Guillen underwent sensitivity training and paid an undisclosed fine after hurling insults, including a derogatory term for gays, at a Chicago Sun-Times columnist.

Hader said he's "ready for any consequences for what happened seven years ago."

Some of his teammates, meanwhile, say they're willing to move past any controversy.

Lorenzo Cain, the Brewers center fielder, who is black, told reporters that the teammate he knows is a "great guy." He added that he didn't know exactly what Hader had previously tweeted.

"He was young, we all say some crazy stuff when we were young. That's one reason I don't have social media," Cain said, adding, "You always get in trouble for things you said when you were younger."