Commissioner Rob Manfred confirmed Tuesday that the Boston Red Sox used electronic communication from the dugout to steal opponents’ signs and relay them to Boston players during games.

Baseball’s investigation of the Red Sox is ongoing, Manfred said from Fenway Park ahead of Boston’s game against Toronto, but he expects it will be completed before the end of the regular season.

News of the investigation was first reported by the New York Times.

Major League Baseball does not have a policy against sign stealing, per se, Manfred said. The issue is the use of a electronic device in the dugout, which is against league rules.

“We actually do not have a rule against sign-stealing,” Manfred said. “It has been a part of the game for a very, very long time. To the extent that there was a violation of the rule here, it was a violation by one or the other [team] that involved the use of electronic equipment. It’s the electronic equipment that creates the violation. I think the rule against electronic equipment has a number of policy reasons behind it, but one of them is we don’t want to escalate attempts to figure out what a pitcher is going to throw by introducing electronics into that mix.

“To the extent there was a violation on either side, we are 100 percent comfortable that it’s not an ongoing issue, that if it happened, it is no longer. I think that’s important from an integrity perspective going forward.”

After MLB corroborated the claims with its own video, the commissioner’s office confronted the Red Sox, who admitted that video replay personnel were getting signs and that those were relayed to some players, The Times reported. The scheme had been ongoing for some weeks.

The Red Sox’s scheme came to MLB’s attention when New York Yankees general manager Brian Cashman filed a complaint with Manfred’s office last month. He supplied video of what the team contended was a Red Sox trainer looking at his Apple Watch, the Times reported, and then relaying information to players — in one instance outfielder Brock Holt and in another infielder Dustin Pedroia — during a series between the teams in Boston.

Asked whether a potential punishment for the Red Sox could be used to deter future incidents, Manfred acknowledged it was a factor that would be weighed.

“When I think about punishment, I think you need to think about deterrents,” he said. “I think you need to think about how the violation has affected the play on the field, and I think you need to think about how it’s affected the perception of the game publicly. All of those things are something that you have to weigh in terms of trying to get to appropriate discipline.”

Red Sox manager John Farrell, whose team is hosting Toronto, said that Boston is “aware of the rule [that] electronic devices are not to be used in the dugout.” When asked to comment further, he said it’s “a league matter.”

Yankees outfielder Brett Gardner, who is in Baltimore for a game against the Orioles, said of the sign stealing, “It was something we expected was going on.”

During Yankees-Red Sox games this year, Yankees catchers increasingly and repeatedly visited the mound to go through the signs or change in sequences verbally — and this was related partly because of the Yankees’ concerns about how the Red Sox were relaying information, sources told ESPN’s Buster Olney.

Sources with knowledge of the situation told ESPN’s Andrew Marchand that the Yankees have suspected the Red Sox were using illegal methods to steal signs for a while, but they could not prove it until the last series in Boston. The Yankees thought something was not right because the Red Sox repeatedly hit pitches hard that the Yankees felt would normally be unhittable — especially with runners in scoring position.

A source also questioned how Farrell and Red Sox general manager Dave Dombrowski did not know about the scheme, considering the Yankees were able to figure it out, and so many players were involved.

The Red Sox have since filed their own complaint, alleging that the Yankees use a camera from their YES Network exclusively for stealing signs.

Sources denied the substance of the Red Sox’s counterclaim, with one saying it was a public relations move to try to muddy the waters.

“There is no meat on the bone,” the source said.

“No chance,” Yankees manager Joe Girardi said.

Manfred added that, “under the major league constitution,” the league does have authority to strip one or both teams of wins, but acknowledged it was unlikely to happen.

“Has it ever happened with this type of allegation? I think the answer is — I know the answer is — no,” Manfred said of stripping either team of wins. “And the reason for that is it’s just very hard to know what the actual impact in any particular game was of an alleged violation like this.”

The investigation is being conducted by Bryan Seeley, who heads MLB’s department of investigations. Seeley is a former assistant U.S. attorney for the U.S. Attorney’s Office in Washington.