In the context of the smart grid, this paper focuses on control and management strategies for integration of distributed energy resources in the power system. This work conceptualizes a hierarchical framework for the control of microgrids-the building blocks of the smart grid-and develops the notion of potential functions for the secondary controller for devising intermediate set points to ensure feasibility of operation. A potential function is defined for each controllable unit of the microgrid such that minimizing the potential function corresponds to achieving the control goal. The set points are dynamically updated using communication within the microgrid. This strategy is generalized to include both local and system-wide constraints. Case studies are presented that show effectiveness of the proposed approach in stabilizing a microgrid in response to disturbances such as load change, line outage, and generator malfunctioning.