We present a principled way of extending a classical AI planning formalism with systems of state constraints, which relate -sometimes determine -the values of variables in each state traversed by the plan. This extension occupies an attractive middle ground between expressivity and complexity. It enables modelling a new range of problems, as well as formulating more efficient models of classical planning problems. An example of the former is planning-based control of networked physical systems -power networks, for examplein which a local, discrete control action can have global effects on continuous quantities, such as altering flows across the entire network. At the same time, our extension remains decidable as long as the satisfiability of sets of state constraints is decidable, including in the presence of numeric state variables, and we demonstrate that effective techniques for costoptimal planning known in the classical setting -in particular, relaxation-based admissible heuristics -can be adapted to the extended formalism. In this paper, we apply our approach to constraints in the form of linear or non-linear equations over numeric state variables, but the approach is independent of the type of state constraints, as long as there exists a procedure that decides their consistency. The planner and the constraint solver interact through a well-defined, narrow interface, in which the solver requires no specialisation to the planning context. Furthermore, we present an admissible search algorithm -a variant of A -that is able to make use of additional information provided by the search heuristic, in the form of preferred actions. Although preferred actions have been widely used in satisficing planning, we are not aware of any previous use of them in optimal planning.