Keri

Keri is a Hebrew term which literally means "accident" or "mishap", and is used as a euphemism for seminal emission. The term is generally used in Jewish law to refer specifically to the regulations and rituals concerning the emission of semen, whether by nocturnal emission, or by sexual activity. A man is said to be a ba'al keri ("one who has had a seminal emission") after he has ejaculated without yet completing the associated purification requirements.

Hebrew Bible
The Book of Leviticus contains several laws relating to seminal emission. A man who had experienced an emission of semen would become ritually impure, until the evening came and he had washed himself in water. Any clothes or leather touched by semen also become ritually impure, until they are washed in water and the evening had come. If the man ejaculated semen during sexual intercourse with a woman, the woman would also become ritually impure, until the evening had come and she had washed herself in water.

The Book of Deuteronomy says that a soldier who became impure through a mikreh lailah ("night occurrence") must leave the army camp, immerse, and only return to the camp in the evening. From the word mikreh (מקרה), the rabbis derived the term keri (קרי) to refer to an emission of semen.

In, prior to the revelation at Mount Sinai, Jewish men were warned not "to approach a woman" so as not to become impure.

The Books of Samuel contain two stories which suggest that the laws of seminal emission were observed in that period. In, Saul assumed that David was missing from the royal feast due to having become impure in a mikreh (mishap). In, the priest is willing to distribute holy bread only to those men who have "kept themself from women".

Non-traditional biblical scholars see the Leviticus regulations as having originally derived from taboo against contact with semen, because it was considered to house life itself, and was thus thought of as sacred.

In rabbinic literature
The Talmud adds prohibitions designed to avoid seminal emission outside of sexual intercourse. It was forbidden for a man to touch his penis with his hand, on the basis that the sensation of touch causes keri. The Talmud goes on to address the concern that preventing any contact with the penis would make urination more awkward for males, and makes suggestions in this regard. A man who intentionally caused himself erections was considered worthy of ostracism.

The Talmud also described procedures in case a man emitted semen (permissibly or otherwise). It states that one who experienced an emission of semen is required by the Torah to immerse in water in order to be allowed to consume terumah or sacrifice. It also states that Ezra decreed that one should also immerse in order to be allowed to recite words of Torah, but that Ezra's decree no longer applies nowadays.

Later on, the Rishonim debated whether Ezra's decree still applies in regard to prayer. Hai Gaon and Chananel ben Chushiel say that a ba'al keri, while he may study Torah, may not pray until he goes to a mikveh. Maimonides says that the decree was cancelled entirely and a ba'al keri may even recite the Shema, but that the minhag of Shinar (Mesopotamia) and Sepharad (in his day, a term for the Iberian Peninsula) is that before prayer a ba'al keri should wash himself entirely with water.

The modern halakhic consensus is that a ba'al keri is not required to immerse in the mikveh before praying, reciting Shema, saying Berakhot, and so on. However, some Jews today, including many Hasidic Jews, practice this immersion because it is considered a praiseworthy practice.