Innate immunity is a widespread and important defence against microbial attack, which in insects is thought to originate mainly in the fat body. Here we demonstrate that the fluid-transporting Malpighian (renal) tubule of Drosophila melanogaster constitutes an autonomous immune-sensing tissue utilising the nitric oxide (NO) signalling pathway. Reverse transcriptase PCR (RT-PCR) shows that tubules express those genes encoding components of the Imd pathway. Furthermore, isolated tubules bind and respond to lipopolysaccharide (LPS), by upregulating anti-microbial peptide (diptericin) gene expression and increased bacterial killing. Excised, LPS-challenged tubules, as well as tubules from LPS-infected flies, display increased NO synthase (NOS) activity upon immune challenge. Targetted expression of a Drosophila NOS (dNOS) transgene to only principal cells of the tubule main segment using the GAL4/UAS system increases diptericin expression. In live flies, such targetted over-expression of dNOS to tubule principal cells confers increased survival of the whole animal upon E. coli challenge. Thus, we describe a novel role of Malpighian tubules in immune sensing and insect survival.