As mentioned before, regulatory agencies are the ones in charge of setting the regulations in a specific zone and making sure people respect them. Those agencies can even work with the government or be part of it.
Regardless of that, there are many online brokers regulatory agencies worldwide. They can establish regulations are a national, international, or regional level. However, those regulations don’t tend to differ a lot from each other, so it’s not difficult to understand them and adapt to them.