Consensus refers to the agreement of networked agents upon certain quantities of interest and has widespread applications in diverse areas in science and engineering. This paper focuses on a new consensus protocol for networked multiagent systems operating in cluttered and hostile environments. Specifically, a consensus optimization algorithm is introduced that renders the Laplacian potential to be a nonincreasing function while minimizing a cost function and satisfying state and cost constraints. In addition, we show how to choose this cost function and the aforementioned constraints in order to decay the Laplacian potential to zero strictly. The proposed framework depends on a local optimization process that is computationally easy to implement. Furthermore, the computation load for each agent does not grow with the network size, and therefore, the proposed consensus protocol is scalable. Considering recent developments in networked multiagent systems and autonomous ground and aerial vehicles, the proposed framework can be used in a complimentary way with many guidance protocols to operate such autonomous systems cooperatively in cluttered and hostile environments. Several numerical examples are further provided to demonstrate the efficacy of our contribution.