Dallas Mavericks guard J.J. Barea has been hired as the head coach of Indios de Mayaguez in the Puerto Rican league for the remainder of the season, which runs through June 27.

"I didn't know it was going to happen now, but I always wanted to coach later on when I finished playing," Barea told ESPN. "This is my hometown team, where I played when I was getting started. I think it's going to be a great experience for myself and see if I really like this and see what I learn and if it can help me out for the future."

Barea replaces coach Bobby Porrata, who was fired with Indios de Mayaguez in last place with a 7-14 record. Barea will run one practice before making his coaching debut Thursday.

He said he received clearance from Mavericks owner Mark Cuban, head coach Rick Carlisle and the NBA office before accepting the job. Carlisle texted Barea his five favorite plays from the Mavs' playbook.

"Great opportunity for J.J. and he will do a tremendous job," Carlisle said via text message.

Barea, 32, a Puerto Rican national team star who played a key role on Dallas' 2010-11 championship team, is under contract with the Mavs through 2018-19 and hopes to get at least one more NBA contract. He averaged 10.9 points and 5.5 assists for the Mavs last season but was limited to 35 games due to a series of calf injuries.

Barea has entertained the thought of trying to begin his coaching career as an NBA or college assistant once he retires as a player.

"I haven't thought too much that far yet," Barea said. "I still want to play four or five more years, and then we'll go from there."