Distributed Multi-Agent Approach For Enhancing Stability And Security of Emerging Smart Grids