Played... modifies role: the factions played a role.
In choosing... is ambiguous, because play a role in is semantically a unitary but very complex metaphor:
The factions play a role in choosing the frontbench.
Olivier plays the Prince in Hamlet.
- The factions are represented as an 'actor portraying a character' (playing a role) in a 'drama', so in choosing... is a prepositional phrase modifying both the factions and the role.
- But the role was played 'in the drama', so in choosing also modifies played.
- Yet the action performed by both the actors and the character was choosing..., so both the factions and the role are the subject of the clause choosing... .
- Finally, the object of over—what the grumbling was about—is not the role but the entire NP headed by the role; and what that NP signifies is the manner in which the drama was performed: how the frontbench was chosen.
The theatrical metaphor is notoriously hard to pin down. Kenneth Burke chose it as the generative core of his study of human relationships, A Grammar of Motives, because "what we want is not terms that avoid ambiguity, but terms that clearly reveal the strategic spots at which ambiguities necessarily arise."