As an independent unit, microgrid operator (MGO) should respond to the energy demand of customers with an optimal provision cost. Apart from the ability to guarantee the security of microgrid (MG) operation, the MGO should consider the greenhouse emission effects as well. This paper investigates a novel energy management system for an islanded MG. In the proposed strategy, two efficient methodologies are used to maximize the profit and security of the MG: (a) the optimal operation of electric vehicles (EVs) in vehicle-togrid (V2G) mode and (b) the use of demand response (DR) program. Besides, a hierarchical control structure is proposed to manage frequency and voltage uncertainties in a permissible range. Improving the reliability of the MG is another goal of the proposed strategy, which is pursued by the studied control-List of Symbols and Abbreviations: l, t, s, indices of group of loads, time period, and scenario, respectively; j, i, k, indices of WT, PV, and DG units, respectively; n, m, indices of buses; B, L, set of buses and loads; E, index of electric vehicle; N L ,N T ,N s , number of scenarios, time period, and group of loads; N J , N I ,N k , number of WT, PV, and DG units; F, objective function; P j,t , scheduled DG active power (kW); P k,t , scheduled WT active power (kW); P i,t , scheduled PV active power (kW); Q j,t , scheduled DG reactive power (kW); Q k,t , scheduled WT reactive power (kW); Q i,t , scheduled PV reactive power (kW); P ref j,t,s , DG power generation reference point for regulation (kW); P l,t , active load demand (kWh); Q l,t , reactive load demand (kWh); P L_V2G e,t , P L_G2V e,t , power loss for V2G (discharging) and G2V (charging) modes (kW); P LE e,t , inverter power loss (kW); P V2G e,t , P G2V e,t , exchanges power between EV and grid; P shed l,t,s , Q shed l,t,s , emergency active and reactive power outage, respectively (KW/KVAR); P min j , P max j , minimum and maximum DG generation power (kW); R U:max j:t , R D:max j:t, maximum participation rate of unit j in providing incremental/decrement spinning reserved power (kW); R NS:max j:t , maximum participation rate of unit j in providing non-spinning reserved power (kW); P max n,m , maximum power passing through the connecting line between bus n and m; C max e , capacity of the battery (kW); V n:t , V m,t , voltage of nodes n and m; ΔV max , maximum voltage deviation for bus n; δ n:t , δ m:t , voltage angle of nodes n and m; G n:r , B n,r , conductance and suspension of the lines between nodes n and m; SOC EV e,tÀ1 , initial level of EV SOC; X EV e,t , binary variable, charging/discharging state; η BTB e , inverter efficiency; B EV e,t , exchanged power between EV and inverter; R NS j,t , scheduled nonspinning reserved power (kW); R U j,t , scheduled incremental spinning reserved power (kW); R D j,t , scheduled decremental spinning reserved power (kW); r NS j,t,s , realized non-spinning reserved power (kW); r U j,t,s , realized incremental spinning reserved power (kW); r D j,t,s , realized decremental spinning reserved power (...