Young purple martin (the one stuck in the house in the first photo) was being attacked and chased by the other martins for whatever reason. To escape them, he went into the house sparrow’s nest, only to be attacked by the male sparrow inside. The sparrow grabs the martin by the head from inside the nest which is what you see happening in the first photo. The other martins weren’t sure what to do but eventually began attacking the young martin again until the sparrow let him go.