The topology optimization problem is formulated in a phase-field approach. The solution procedure is based on the Allan–Cahn diffusion model where the conservation of volume is enforced by a global constraint. The functional defining the minimization problem is selected such that no penalization is imposed for full and void materials. Upper and lower bounds of the density function are enforced by infinite penalty at the bounds. A gradient term that introduces cost for boundaries and thereby regularizing the problem is also included in the objective functional. Conditions for stationarity of the functional are derived, and it is shown that the problem can be stated as a variational inequality or a max–min problem, both defining a double obstacle problem. The numerical examples used to demonstrate the method are solved using the FEM, whereas the double obstacle problem is solved using Howard's algorithm. Copyright © 2012 John Wiley & Sons, Ltd.