The basal ganglia have been hypothesized to be involved in action selection, i.e. resolving competition between simultaneously activated motor programs. It has been shown that the direct pathway facilitates action execution whereas the indirect pathway inhibits it. However, as the pathways are both active during an action, it remains unclear whether their role is co-operative or competitive. In order to investigate this issue, we developed a striatal model consisting of D1 and D2 medium spiny neurons (MSNs) and interfaced it to a simulated robot moving in an environment. We demonstrate that this model is able to reproduce key behavioral features of several experiments involving optogenetic manipulation of the striatum, such as freezing and ambulation. We then investigate the interaction of D1- and D2-MSNs. We find that their fundamental relationship is co-operative within a channel and competitive between channels; this turns out to be crucial for action selection. However, individual pairs of D1- and D2-MSNs may exhibit predominantly competition or co-operation depending on their distance, and D1- and D2-MSNs population activity can alternate between co-operation and competition modes during a stimulation. Additionally, our results show that D2–D2 connectivity between channels is necessary for effective resolution of competition; in its absence, a conflict of two motor programs typically results in neither being selected.