Alex was part of a large group of friends and was happy to help out when one was in need. Given the context: Why did Alex do this?
Answer:
did this out of friendship