Legislative immunity is a legal doctrine that protects legislators from being sued or prosecuted for actions taken in the course of their legislative duties, ensuring they can perform their roles without fear of external legal repercussions. This principle is crucial for maintaining the independence and integrity of legislative bodies, allowing lawmakers to debate and legislate freely.