This paper considers various tests of the unit root hypothesis in panels where the cross-section dependence is due to common dynamic factors. Three situations are studied. First, the common factors and idiosyncratic components may both be nonstationary. In this case test statistics based on generalized least squares (GLS) possess a standard normal limiting distribution, whereas test statistics based on ordinary least squares (OLS) are invalid. Second, if the common component is I(1) and the idiosyncratic component is stationary (the case of cross-unit cointegration), then both the OLS and the GLS statistics fail. Finally, if the idiosyncratic components are I(1) but the common factors are stationary, then the OLS-based test statistics are severely biased, whereas the GLS-based test statistics are asymptotically valid in this situation. A Monte Carlo study is conducted to verify the asymptotic results.The research for this paper was carried out within research project Unit roots and cointegration in panel data financed by the German Research Association (DFG). We thank Paulo Rodrigues and two anonymous referees for helpful comments and suggestions.