The Facebook logo is displayed on their website in an illustration photo taken in Bordeaux, France, February 1, 2017.REUTERS/Regis DuvignauFacebook’s shares lost as much as a quarter of their value on Wednesday after executives said that profit margins would plummet for several years due to the costs of improving privacy safeguards and slowing usage in the biggest advertising markets.The second-quarter results were the first sign that a new European privacy law and a succession of privacy scandals involving Cambridge Analytica and other app developers have bit into Facebook’s business. The company further warned that the toll would not be offset by revenue growth from emerging markets and Facebook’s Instagram app, which has been more immune to privacy concerns.Facebook’s fortunes shifted in under two hours as the company first reported revenue and user growth that missed expectations and then issued warnings about future growth and expenses.Operating profit margin, which fell to 44 percent in the second quarter from 47 percent a year ago, will sink to the “mid-30s” for more than two years, Chief Financial Officer David Wehner said in investor guidance.The plummeting stock price wiped out as much as $150 billion in market capitalization and erased the stock’s gains since April when Facebook announced a surprisingly strong 63 percent rise in profit and an increase in users.If the share drop holds on Thursday, it would be Facebook’s largest single-day decline, topping a 12 percent decrease in July 2012.Facebook had cautioned investors to expect a big jump in second-quarter costs because of efforts to address concerns about the poor handling of users’ privacy and to better monitor what users post. Total expenses in the second quarter surged to $7.4 billion, up 50 percent compared with a year ago.Its gloomy forecast for revenue growth surprised investors, though, and prompted many questions from financial analysts on a conference call with company executives on Wednesday. A WhatsApp logo is seen behind a phone that is logged on to Facebook in the central Bosnian town of Zenica, February 20, 2014.REUTERS/Dado Ruvic/File PhotoThe General Data Protection Regulation (GDPR) in the European Union also will cause a revenue drop. The new privacy law forced several changes to Facebook’s privacy terms and sign-up process, leading a minority of users to opt for non-personalized ads, which tend to generate less revenue.The company said for the first time that more than 2.5 billion users interact with at least one of its apps each month, but analysts have said many of them are spending more time with Messenger, WhatsApp and Instagram. Commercialization of those apps is nascent.Revenue from emerging markets has not picked up the slack either. Sales from the United States, Canada and Europe fell $75 million in the second quarter compared with a year ago, while revenue from other markets rose $51 million.