The evolution of prostate cancer from an androgen-dependent state to one that is androgen-independent marks its lethal progression. The androgen receptor (AR) is essential in both, though its function in androgen-independent cancers is poorly understood. We have defined the direct AR-dependent target genes in both androgen-dependent and -independent cancer cells by generating AR-dependent gene expression profiles and AR cistromes. In contrast to what is found in androgen-dependent cells, AR selectively upregulates M-phase cell-cycle genes in androgen-independent cells, including UBE2C, a gene that inactivates the M-phase checkpoint. We find that epigenetic marks at the UBE2C enhancer, notably histone H3K4 methylation and FoxA1 transcription factor binding, are present in androgen-independent cells and direct AR-enhancer binding and UBE2C activation. Thus, the role of AR in androgen-independent cancer cells is not to direct the androgen-dependent gene expression program without androgen, but rather to execute a distinct program resulting in androgen-independent growth.