AbstractWe aim to identify the role of revenue diversification and the municipally owned companies’ financial flexibility in shaping the short‐term and the long‐term debt of municipalities in Poland and this debt's repayments. To reflect the impact of this agency relationship on the municipalities’ debt, we consider explanatory variables from two sectors: public and corporate finance. We merge data retrieved from the Local Data Bank, the financial and budget statements of municipalities, and the municipally owned companies’ financial and ownership data from the ORBIS database. We use the ordinary least squares method for cross‐sectional data and the ordinal logit model to estimate a firm's unused debt capacity. We show that a municipally owned company's leverage extends the long‐term debt capacity of municipalities via off‐balance sheet financing. The municipally owned companies’ financial flexibility helps municipalities increase their revenue diversification and shape their debt to cover capital spending despite limited fiscal autonomy under fiscal debt constraints. Unlike revenue diversification in the USA, revenue diversification in Poland does not allow Polish municipalities to reduce short‐term debt. We contribute to the literature by exploring the role of the municipally owned companies’ financial flexibility (leverage and unused debt capacity) in shaping a municipality's debt capacity.