The Hebrew Bible is considered a holy text in most Abrahamic religions. It records a large number of events and laws that are endorsed or prescribed by the God of Israel, as well as others carried out by various persons. Judaism teaches that the Torah contains 613 eternal commandments, many of which deal with law and punishment, on the personal and national scales. Christianity has also adapted and adopted many of these directives. In another vein, the text often expressly uses national or personal events as practical lessons to illustrate God's power and as morality tales.
In the Book of Exodus
Moses negotiating the Exodus from Egypt with Pharaoh leading up to the Ten plagues: First Pharaoh enslaves the Children of Israel: "[The Egyptians] appointed conscription officers over [the Israelites] to crush their spirits with hard labor. [The Israelites] were to build up the cities of Pithom and Ra'amses as supply centers for Pharaoh...The Egyptians started to make the Israelites do labor designated to break their bodies. They made the lives of [the Israelites] miserable with harsh labor involving mortar and bricks, as well as all kinds of work in the field. All the work they made them do was intended to break them." (Exodus 1:11-14 , then he issues decrees to kill all the Israelite males (Exodus 1:15-16) (Moses is saved by his mother putting him into an ark of bulrushes), and after first being the option of freely letting the Israelite slaves go, God hardens Pharaoh's heart, so that Pharaoh does not agree to let the Hebrews leave, then God sends various disasters onto the whole of Egypt, the cycle ends with the story of the killing of every firstborn child in Egypt as the final punishment for having afflicted the Israelites with deathly punishments. (Exodus 6-14)
The people of Midian together with Moab began to interact with the people of Israel, including sexual relationships: "Israel was staying in Shittim when the people began to behave immorally with the Moabite girls. [The girls] invited the people to their religious sacrifices, and the people ate, and worshiped the [Moabite] gods." Numbers 25:1-2 
For these transgressions, the Midianites were attacked by Moses and his followers (Num 31:1-54). When Moses learns that some Midianites have been spared (Num 31:15), he orders all males and non-virgin females killed, and all the virgin females to be taken captive (Num 31:17,18). The virgins were divided among the priests and the people. (Num 31:32-35). The text does not specifically describe their treatment afterwards. For their hesitation in killing the all the male children and the non-virgin females, God punished His people with a plague (Numbers 31:16).
- Canaan was cursed to become a slave ("servant of a servant") by Noah. This was as punishment for Canaan's father Ham "seeing his father's (Noah's) nakedness." (Genesis 9.20-9.25) According to some traditional opinions, this Biblical phrase is a euphemism meaning either rape or castration. Many modern Bible critics, however, dispute this.
- Lot's wife was turned into a pillar of salt (assumedly by God) for looking back when fleeing Sodom. (Genesis 19:26) Lot's family had been specifically warned not to look at the destruction of the wicked people of Sodom.
- Onan was killed by God for refusing to carry on his brother Er's family line in the context of his levirate marriage to Er's widow, and instead "spilling his seed" on the ground. (Genesis 38:5)
Examples of the death penalty
The Bible prescribes the death penalty for the following activities, among others:
- Sex crimes, including adultery, male homosexual sex, bestiality (Leviticus 20) and rape (Deuteronomy 22)
- A betrothed woman who does not cry out while being raped (Deuteronomy 22:23-4)
- A woman who is found not to have been a virgin on the night of her wedding (Deuteronomy 22:13-22) (in Judaism, this is traditionally understood as referring to a woman who committed adultery while betrothed)
- Worshiping other gods (Deuteronomy 13:6-13:10, Exodus 22:20)
- Witchcraft (Exodus 22:18)
- Taking God's name in vain or cursing God's name (Leviticus 24:16)
- Cursing a parent (Exodus 21:15, 21:17, Leviticus 20:9, and in the New Testament Mark 7:10)
- Kidnapping (Exodus 21:16)
From a contemporary standpoint, some of the punishments and laws described in the Bible are viewed as being morally questionable, or even abhorrent. Some typical points of criticism of the Bible's legal code include:
The Bible tacitly endorses certain forms of slavery; it records many laws and procedures dealing with slaves.
The Bible's strictures on homosexual sex are seen as outmoded by some groups. As well, the Bible's endorsement of capital punishment and its restriction on adultery are often viewed in a similar light. On the other hand, more conservative critics are more critical of the Bible's permissivity toward polygamy.
Even among proponents of capital punishment, many of the crimes which the Bible records as punishable by death are not currently regarded as deserving of this penalty. Examples include idol worship, as well as the crimes of striking or cursing one's parents.
Additionally, many of the military punishments recorded in the Bible would today be considered to be war crimes, or, at the very least, unwarranted and excessive. These events are sometimes labeled "atrocities" by critics of Christianity (fundamentalist Christianity in particular), and presented as examples of ridiculousness, inconsistency and hypocrisy in those who subscribe to a literal interpretation of the Bible. One website summarizes the argument: "Myth: The Bible is morally pure and free from atrocity. Fact: The Bible is filled with countless acts of barbarism and tyranny."  The argument dates back at least as far as 1795, voiced by Thomas Paine in The Age Of Reason.
- Thomas Paine, Age of Reason, 1795.