In all modern bureaucracies, politicians retain some discretion in public employment decisions, which may lead to frictions in the selection process if political connections substitute for individual competence. Relying on detailed matched employer-employee data on the universe of public employees in Brazil over 1997-2014, and on a regression discontinuity design in close electoral races, we establish three main findings. First, political connections are a key and quantitatively large determinant of employment in public organizations, for both bureaucrats and frontline providers. Second, patronage is an important mechanism behind this result. Third, political considerations lead to the selection of less competent individuals.