Deuteronomy records a lengthy exhortation by Moses to the second-generation post-exodus Israelites, in which he repeatedly urges them to love and obey God, love others, and not fall into idolatry.
Chapter 22 opens with instructions about being neighborly, then warns against several forms of idolatry, and finishes with some discussions about how to approach marriage in a respectful way.
In the middle of the idolatry section we read the following command given by Moses to the Israelites:
If you happen to come upon a bird’s nest along the way, in any tree or on the ground, with young ones or eggs, and the mother sitting on the young or on the eggs, you shall not take the mother with the young; you shall certainly let the mother go, but the young you may take for yourself, in order that it may be well with you and that you may prolong your days. -Deuteronomy 22:6-7
What does this have to do with the context in which it is found, and with the overall theme of the Law?
