In this article we use panel-estimation techniques to calculate discretionary accruals (DAC) and to produce a better understanding of the nature of the relation between debt and earnings management. Consistent with the transparency hypothesis (which suggests that diversification increases the complexity of firms' activities and reduces their transparency to outsiders), we find that for less-diversified (more transparent) firms, debt reduces positive discretionary accruals, whereas in relatively more-diversified (less transparent) firms the impact of debt becomes positive. Our paper shows that marginal increases in debt provide the incentives for managers to manipulate earnings, and diversification provides the needed context for this accounting practice to be possible. We have also found that only in the sub-sample of aggressive firms, those that manage discretionary accruals with enough magnitude to increase income, do lenders exert their control. Some firms, however, take advantage of diversification to avoid this control. Our findings are robust to several earnings-management measures and methodologies.