A nitrogen-containing heterocyclic compound or pharmaceutically acceptable salt thereof represented by the general formula:which have a potent antibacterial activity and a high safety. Thus, the compounds are useful as antibacterial agents against gram-positive bacteria, gram-negative bacteria and drug resistant bacteria.