Facebook confirmed on Wednesday that it is under investigation by the Federal Trade Commission for potentially violating antitrust laws. The regulatory agency told the social media giant it was under investigation in June, according to the company's securities filings.

The FTC on Wednesday also announced that Facebook would pay a $5 billion fine for allowing data-mining companies to harvest users' data without their knowledge of consent, a record for a privacy violation.

The settlement followed an announcement by the Department of Justice the previous day that it has launched a broad antitrust probe into unspecified technology companies. The agency did not say what companies it's looking into, but antitrust concerns have long swirled around Amazon, Apple, Facebook and Google.

Get Breaking News Delivered to Your Inbox

Despite Facebook's transgressions on user privacy, the company's revenues keep rising. The company made $4.6 billion in profits on $16.9 billion in revenue in the three months ending June 30, Facebook reported on Wednesday. Legal expenses related to the FTC settlement shrank the company's profit margin to 27%, down from 44% in the year-ago period.

Facebook signed up 39 million users worldwide, bringing its monthly active users to 2.4 billion. In Europe and North America, the company added an additional 2 million users.

Facebook shares, which rose just over 1% on the day, added 1.9% in after-hours trading.