A hierarchical excavated iron-nitrogen codoped mesoporous carbon (Ex-FeN-MC) electrocatalyst has been successfully synthesized by pyrolysis of the unique ureidopyrimidinone containing organic precursor MAMIS by using silica as the mesoporous template and iron nitrate as the source of iron. The selected organic precursor has multifunctionalities with diverse distribution of nitrogen and oxygen species which constitute interesting features to prepare the Ex-FeN-MC electrocatalyst. The as-prepared Ex-FeN-MC material shows unexpectedly higher catalytic activities towards ORR/OER performances with an overpotential of 250 mV for OER in alkaline solution at a current density of 10 mA cm-2, while the ORR activity is almost similar to that of commercial Pt/C. It is believed that the excellent electrochemical performance results from the synergic contribution of the hierarchical uniform mesoporous structure, evenly distributed iron nanoparticles and high density of Ex-FeN-MC catalytically active sites. The presence of the hierarchical uniform mesoporous structure considerably accelerates the mass transfer and efficiently promotes the full utilization of active sites. Furthermore, it also possesses amorphous carbon in coexistence with lattice graphitic carbon which also enhanced the ORR/OER performances. Our research findings can surely provide a new insight to design highly active ORR/OER electrocatalysts by utilizing more novel organic precursors to provide interesting characteristics to electrocatalysts, as well as open up a route for constructing unique multifunctional materials with mesoporous architectures for electrocatalysis and supercapacitor applications.