Abstract In this paper we consider optimal control problems where the control variable is a potential and the state equation is an elliptic partial differential equation of Schrödinger type, governed by the Laplace operator. The cost functional involves the solution of the state equation and a penalization term for the control variable. While the existence of an optimal solution simply follows by the direct methods of the calculus of variations, the regularity of the optimal potential is a difficult question and under the general assumptions we consider, no better regularity than the BV \mathrm{BV} one can be expected. This happens in particular for the cases in which a bang-bang solution occurs, where optimal potentials are characteristic functions of a domain. We prove the BV \mathrm{BV} regularity of optimal solutions through a regularity result for PDEs. Some numerical simulations show the behavior of optimal potentials in some particular cases.