Final answer:
The Sarbanes-Oxley Act of 2002 prohibits accounting firms from providing consulting services to companies they audit, aiming to prevent conflicts of interest and protect investors from accounting fraud as a result of major corporate scandals.
Step-by-step explanation:
The legislation that prohibits accounting firms from providing consulting services to companies they audit is the Sarbanes-Oxley Act of 2002. This Act came into existence following major accounting scandals involving corporations such as Enron, Tyco International, and WorldCom. These scandals diminished investor trust and highlighted the need for stringent regulations to prevent conflicts of interest and accounting fraud.
The Sarbanes-Oxley Act was designed to restore confidence in the financial information provided by public corporations and includes measures that separate auditing from consulting services, among various other reforms aimed at enhancing corporate accountability and transparency.