The interplay of competition and cooperation