The crisis over Russian-bought ads hasn't slowed down Facebook yet, but it might.

Facebook (FB) said Wednesday that sales topped $10 billion in the third quarter, up nearly 50% from the same quarter a year earlier, fueled by the continued strength of its advertising products. Its profits jumped 79% to $4.7 billion for the quarter.

But CEO Mark Zuckerberg said profits will take a hit as the company invests more heavily in security.

"We're serious about preventing abuse on our platforms. We're investing so much in security that it will impact our profitability," Zuckerberg said in a statement. "Protecting our community is more important than maximizing our profits."

"I wanted our investors to hear that directly from me," Zuckerberg said about the security investment, speaking on an earnings call. "I believe that will make our society stronger."

The earnings report was released as a Facebook exec was testifying in the last of three hearings before Congress this week into how Russian actors used social media to meddle in the 2016 presidential election.

"I've expressed how upset I am that the Russians tried to use our tool to sow distrust," Zuckerberg said on the call. "What they did is wrong and we are not going to stand for it."

"I am dead serious about this," he added.

Zuckerberg said protecting the security of the social network "goes beyond elections." It also means "strengthening all our systems to prevent abuse"

At the hearings, Facebook, Twitter (TWTR) and Google (GOOG) were pressed on whether they're even capable of preventing bad actors from taking advantage of their platforms through ads and regular posts.

Related: Why aren't the CEOs of Facebook, Google and Twitter testifying?

Colin Stretch, Facebook's general counsel, said at one hearing that Facebook had more than 10,000 people working on safety and security and would have more than 20,000 people working on those efforts by the end of 2018.

It's unclear how many of those people will be full-time employees as opposed to contractors. Facebook CFO David Wehner said the current 10,000 figure includes "employees at Facebook and also employees at partners."

Beyond the added headcount, Zuckerberg said Facebook is also investing more in engineering teams focused on security and artificial intelligence solutions.

Zuckerberg stressed on the call that these investments aren't just important for the company and its users. "It's part of our responsibility to society," he said.

The drastic increase in security efforts highlights the challenge of policing an audience that numbers in the billions. Facebook now has 2.07 billion monthly users and 1.37 billion people who use the platform every day, according to its earnings report.

"Our community continues to grow and our business is doing well," Zuckerberg said in the statement. "But none of that matters if our services are used in ways that don't bring people closer together."

Facebook stock closed at an all-time high of $182.66 a share on Wednesday. Shares dipped slightly in after hours trading as Facebook execs teased plans to ramp up investments in security as well as video content and virtual reality.

Facebook expects its total expenses for 2018 to jump as much as 60% from 2017.