I was recently playing football in a recreational league, when a teammate was fouled. The referee awarded us a direct free kick, and seeing that the opponents were choosing to argue with the referee instead of defending, I took the opportunity to take the free kick quickly.
I placed the ball in the correct position, and as I went to take it, an opponent moved and stood directly in front of the ball, making no effort to get back. I kicked the ball anyway, hoping it would go through his legs. Instead, the ball became caught between us and since it was in play, I began kicking at it trying to get it out.
The referee began yelling, asking me what I was doing, and then told me to wait for the whistle. At this point, all of their defenders were allowed to get back into position, marking all of our attackers and forming a wall in front of the ball. The referee then told me he didn't have to allow a retake, but he was "doing me a favour".
Was this handled correctly by the referee? As a supplementary question, if the referee is refusing to enforce the required distance correctly, what strategies can I use to avoid opponents preventing me from taking a quick free kick?