I was going through the security E-gates when I was separated from my husband as his passport was not scanning. The officer at security (dark skin tone wearing green/khaki uniform) was telling 2 men to proceed through security but they were not moving. When I realised my husband wasn't behind me I started to walk back to the gates to see what was happening. At the same time, the security officer was shouting more at these men to leave and wait for their family after security - he saw that I had turned back and approached me and took my passport and just walked off with it without explaining anything. I followed him as I thought he was helping me to get to my husband but he was giving it to another staff member and told them to fine me. I was really confused and asked him what does he mean by this and he ignored me and spoke in arabic to the other 2 men and told them that he will let them off with a warning. He then asked me "how many times did I tell you to wait after security?", I tried to explain to him that I did not know that he was talking to me and I was just looking for my husband as I was alone and didn't know what to do next. He then proceeded to say that I was disrespecting him and his job and I was really confused and tried to tell him politely that I was sincerely not trying to disrespect him. I apologised for not listening and explained it was only because I was worried that I was separated from my husband. The man who he gave my passport to was not issuing a fine so he called another person and said "I have a British girl here - you need to cancel her flight." I was really shocked and kept apologising but he kept ignoring me and he still had my passport so this was even more worrying for me. My husband then came and we explained the situation, my husband apologised too to try and calm the situation down. The officer then said to me "Look how polite your husband is speaking compared to how you were speaking" - although I was polite during the entire situation. Only after my husband's intervention did he return my passport so I can't imagine what would have happened if I was travelling alone. This is extremely worrying as he clearly treated me differently to the other men that he had numerously told to proceed forward. I understand I should've proceeded through security but I was just worried and appropriately informed that I could not wait in this area and apologised to him straight away but he tried to fine me and cancel my entire flight? How would this be fair. From the initial interaction with him, he was aggressive towards me. I have visited Qatar 2 times before this and have never had an experience like this before.