Cu-doped GaN films were epitaxially grown by molecular beam epitaxy on C-plane sapphire substrates with an AlN buffer layer. Growth under metal-rich and nitrogen-rich conditions was investigated for different Cu-to-Ga beam-equivalent-pressure ratios x BEP. The samples were characterized by scanning electron microscopy, energy dispersive x-ray spectroscopy, and x-ray diffraction. Films within a narrow range of x BEP around 1% exhibit ferromagnetic behavior with a Curie temperature higher than 400 K. For higher x BEP1%, islands of a Cu-Ga compound are predominantly formed at the surface as nonferromagnetic precipitates. Our detailed study shows that the saturation magnetization of ferromagnetic films with x BEP 1% decreases with increasing film thickness. This suggests that the ferromagnetism arises from defects, such as threading dislocations, created by the incorporation of Cu into the GaN.