In a distributed sensor network, large number of sensors deployed which communicate among themselves to selforganize a wireless ad hoc network. We propose an energyefficient level-based hierarchical system. We compromise between the energy consumption and shortest path route by utilizing number of neighbors (NBR) of a sensor and its level in the hierarchical clustering. In addition, we design a Secure Routing Protocol for Sensor Networks (SRPSN) to safeguard the data packet passing on the sensor networks under different types of attacks. We build the secure route from the source node to sink node. The sink node is guaranteed to receive correct information using our SRPSN. We also propose a group key management scheme, which contains group communication policies, group membership requirements and an algorithm for generating a distributed group key for secure communication.