Authorities in the Dominican Republic arrested the alleged mastermind behind the shooting that left Boston Red Sox legend David Ortiz wounded earlier this month in an apparent case of mistaken identity.

Victor Hugo Gomez was detained in the Caribbean country, police said Friday. No other details were released. Authorities said last week they believed Gomez was living in the U.S.

PLOT THAT WOUNDED ORTIZ UNRAVELED BECAUSE OF MANY MISTAKES

Gomez is a resident of Katy, Texas, and an alleged associate of Mexico’s Gulf Cartel, which is a drug trafficking organization, according to KTRK-TV. Officials said Gomez hired hitmen to take out his cousin whom Gomez suspected of turning him into Dominican drug investigators in 2011, according to the station.

Authorities said the hitmen confused Ortiz with the cousin – Sixto David Fernandez – during the June 9 shooting at a bar in Santo Domingo. Ortiz and Fernandez were sharing a table at the time.

Ortiz was shot and immediately taken to a hospital in the Dominican Republic before being flown to Boston for further treatment. Doctors had to remove Ortiz’s gallbladder and part of his intestine.

Ortiz was since released from intensive care and was listed in good condition, his wife Tiffany Ortiz said in a statement over the weekend.

DOMINICAN REPUBLIC OFFICIALS BELIEVE THEY HAVE IDENTIFIED MAN WHO PAID DAVID ORTIZ HITMEN

The investigation into the shooting has led to 12 arrests.

The Associated Press contributed to this report.