A race condition occurs when two or more processes or threads access shared resources in a way that the outcome depends on the relative timing of these processes. This can lead to unexpected behavior, including crashes, data corruption, or even security vulnerabilities.