Were the lies of Rahab and the Hebrew midwives justified?

Question:
What about Rahab and the Hebrew midwives who lied to protect the lives of others (Joshua 2:3-6; Exodus 1:16-20)? We are told that “God dealt well with the midwives” (Exodus 1:20) and, “By faith the harlot Rahab perished not…when she had received the spies with peace” (Hebrews 11:31; also James 2:25). Does this mean that their lies were justified?

Answer:
“The midwives feared God, and did not as the king of Egypt commanded them, but saved the men children alive” (Exodus 1:17). And Rahab hid the spies because she realized that “The Lord your God, He is God in heaven above, and in earth beneath” (Joshua 2:11).

Both Rahab and the midwives manifested faith in the God of Israel, and God rewarded their faith, even though in both cases weakness of that faith was manifested in their telling falsehoods. In James 2:25 we read, “Likewise also was not Rahab the harlot justified by works when she had received the messengers, and had sent them out another way?” Notice that it does not say that Rahab was justified by words (that is, by her falsehood), but by works (that is, by her protection of the spies). We can be sure that had Rahab and the midwives been stronger in their faith and confidence in the Lord, they still would have been able to carry out their missions for the Lord without having to tell lies.