A main issue in improving public sector efficiency is to understand to what extent public appointments are based on worker capability, instead of being used to reward political supporters (patronage). I contribute to a recent literature documenting patronage in public sector employment by establishing what type of workers benefit the most from political connections. Under the (empirically supported) assumption that in close elections the result of the election is as good as random, I estimate a causal forest to identify heterogeneity in the conditional average treatment effect of being affiliated to the party of the winning mayor. Contrary to previous literature, for most positions we find positive selection on education, but a negative selection on (estimated) ability. Overall, unemployed workers or low tenure employees that are newly affiliated to the winning candidate's party benefit the most from political connections, suggesting that those are used for patronage.Comment: 23 pages, 9 pages appendix, 3 figures (main text), 3 tables (main text)