JUPITER, Fla. -- Major League Baseball is looking into possible sports-related gambling ties involving Miami Marlins pitcher Jarred Cosart, a league official confirmed to ESPN.com and the Miami New Times on Wednesday.

Cosart, 24, allegedly exchanged multiple direct messages with a gambling authority on his Twitter account, and the interaction became public and created a social media storm when it was shared on the site by a third party. Cosart deleted his official Twitter account after screen shots of the exchange began appearing on the Internet on Tuesday night.

Jarred Cosart said Wednesday that his initial Twitter account had been hacked to create direct message conversations about his alleged gambling. AP Photo/Chris O'Meara

MLB spokesman Pat Courtney confirmed that the commissioner's office is investigating the matter, which was first reported by the Miami New Times.

It's unclear whether the allegations involving Cosart revolve around baseball betting or sports betting in general. MLB Rule 21 prohibits gambling on baseball.

"Any player, umpire, or club or league official or employee, who shall bet any sum whatsoever upon any baseball game in connection with which the bettor has no duty to perform, shall be declared ineligible for one year," the rule states. "Any player, umpire, or club or league official or employee, who shall bet any sum whatsoever upon any baseball game in connection with which the bettor has a duty to perform shall be declared permanently ineligible."

Courtney confirmed Wednesday that it is not against MLB rules for players to legally gamble on sports other than baseball.

Cosart appears to have opened a new, unconfirmed Twitter account. On it, he alleged Wednesday that his initial account had been hacked to create the direct message conversations.

The Marlins acquired Cosart from Houston in a seven-player trade in July and have plugged him into their starting rotation this spring. He is 0-2 with an 8.49 ERA in four Grapefruit League outings.

The Marlins issued a brief statement on the matter, saying, "Major League Baseball is aware and they are investigating it and we have no further comment at this time."

Cosart's agent, Erik Burkhardt of Select Sports Group, did not respond to a phone call and email seeking comment.