A theory for the formation of phase holograms in lithium niobate and similiar materials is presented. The experimental situation considered is that of an open-circuited crystal with no applied voltage. The present theory differs from previous theories in that the electric field is treated self-consistently in agreement with basic electrostatic laws. It is found to be important to account for the dark conductivity of the crystal. Several new results are obtained: The dependence of stationary-state diffraction efficiency on light intensity is predicted. The influence of previous illumination of the crystal is investigated. It is shown that the phase shift between the interference pattern and the refractive-index pattern changes during hologram recording. Nonlinear effects occurring at high modulation indices are evaluated. The effect of piezoelectricity on hologram recording is discussed.