The Drosophila peptidoglycan recognition protein SA (PGRP-SA) is critically involved in sensing bacterial infection and activating the Toll signaling pathway, which induces the expression of specific antimicrobial peptide genes. We have determined the crystal structure of PGRP-SA to 2.2-A resolution and analyzed its peptidoglycan (PG) recognition and signaling activities. We found an extended surface groove in the structure of PGRP-SA, lined with residues that are highly diverse among different PGRPs. Mutational analysis identified it as a PG docking groove required for Toll signaling and showed that residue Ser158 is essential for both PG binding and Toll activation. Contrary to the general belief that PGRP-SA has lost enzyme function and serves primarily for PG sensing, we found that it possesses an intrinsic L,D-carboxypeptidase activity for diaminopimelic acid-type tetrapeptide PG fragments but not lysine-type PG fragments, and that Ser158 and His42 may participate in the hydrolytic activity. As L,D-configured peptide bonds exist only in prokaryotes, this work reveals a rare enzymatic activity in a eukaryotic protein known for sensing bacteria and provides a possible explanation of how PGRP-SA mediates Toll activation specifically in response to lysine-type PG.