Definitely don't put it back in the tank. You could keep it if you want until you verify exactly what kind it is, but usually they are bad.
Personally i would probably just get rid of it, especially if you have any coral or plan to have coral in your tank. Usually those small nudis are coral eaters and can/will lay eggs.
They are really hard to identify, there are tons of different types. I wish I could give you an exact id. I have never seen one with the curly tentacles. If you keep googling you will find pages and pages of different types lol.
Good luck!