A highly efficient, low-cost (precious-metal-free), highly stable nanohybrid electrocatalyst containing carbon-supported molybdenum carbide and nitride nanoparticles of size ranging from 8 to 12 nm exhibit excellent HER catalytic activity.