KALISPELL, Mont. — The last mistake Dan Fredenberg made was getting killed in another man’s garage.

It was Sept. 22, and Mr. Fredenberg, 40, was upset. He strode up the driveway of a quiet subdivision here to confront Brice Harper, a 24-year-old romantically involved with Mr. Fredenberg’s young wife. But as he walked through Mr. Harper’s open garage door, Mr. Fredenberg was doing more than stepping uninvited onto someone else’s property. He was unwittingly walking onto a legal landscape reshaped by laws that have given homeowners new leeway to use force inside their own homes.

Proponents say the laws strengthen people’s right to defend their homes. To others, they are a license to kill.

That night, in a doorway at the back of his garage, Mr. Harper aimed a gun at the unarmed Mr. Fredenberg, fired and struck him three times. Mr. Fredenberg crumpled to the garage floor, a few feet from Mr. Harper. He was dead before morning.

Had Mr. Fredenberg been shot on the street or sidewalk, the legal outcome might have been different. But on Oct. 9, the Flathead County attorney decided not to prosecute, saying that Montana’s “castle doctrine” law, which maintains that a man’s home is his castle, protected Mr. Harper’s rights to vigorously defend himself there. The county attorney determined that Mr. Harper had the right to fetch his gun from his bedroom, confront Mr. Fredenberg in the garage and, fearing for his safety, shoot him.