This is actually something they are talking about. Where if you are online when someone attacks, you will have the option to manually take over, and defend your city, or let the AI keep in control. Yes, if you take over manually, and lose your troops they will actually be lost, and I would also think that it will count towards battle points if you defend successfully. Give it time, it will happen someday during this beta phase.