We use the quantum theory of feedback developed by Wiseman and Milburn [Phys. Rev. Lett. 70, 548 (1993)] and Wiseman [Phys. Rev. A 49, 2133 (1994)] to investigate the photon-number noise properties of the micromaser with direct detection feedback. We find that the feedback can significantly reduce the amount of noise in the photon number. Under the right conditions the feedback locks the systems onto a number state. As opposed to other schemes in the past [P. Meystre, Opt. Lett. 12, 669 (1987); J. Krause, M. O. Scully, and H. Walther, Phys. Rev. A 36, 4547 (1987)], we can fix the number states to which the system evolves. We also simulate the micromaser using the quantum-trajectories method and show that these results agree with the quantum theory of feedback. We show that the noise of quantum island states [P. Bogar, J. A. Bergou, and M. Hillary, Phys. Rev. A 50, 754 (1994)] can be significantly reduced by the feedback.