Through a system of checks and balances, the legislature separates powers in the government.
For instance, the president of the United States of America can veto bills that the are issued by the Congress, but the Congress needs to have a 2/3 majority vote for that bill to pass after the president's veto.
Moreover, the Supreme Court has the power to declare a bill unconstitutional so it will not be allowed to pass i.e. all bills must be evaluated by the Supreme Court before they are declared laws.