Discrimination occurs when individuals or groups are treated unfairly or differently based on certain characteristics such as race, gender, religion, or nationality. Judicial stereotyping can lead to discriminatory practices within the legal system.