Funny thing: If he was TRYING to score in the wrong basket, it wouldn't count.
From the FIBA rules:
16.2.2 If a player accidentally scores a field goal in his team’s basket, the goal counts 2 points and shall be entered on the scoresheet as having been scored by the captain of the opponents’ team on the playing court.
16.2.3 If a player deliberately scores a field goal in his team’s basket, it is a violation and the goal does not count.