Why is nitrogen-fixing bacteria found only in the roots of leguminous plants?

Roots nodules are special structures present only in the % roots of leguminous plants, which provide shelter to nitrogen-fixing bacteria (i.e. Rhizobium). Therefore, it is found only in roots of the leguminous plants.