WASHINGTON — Google acted illegally to maintain a monopoly in some online advertising technology, a federal judge ruled Thursday, adding to legal troubles that could reshape the $1.88 trillion company and alter its power over the internet.

Judge Leonie Brinkema of U.S. District Court for the Eastern District of Virginia said in a ruling that Google had broken the law to build its dominance over the system of technology that places advertisements on pages across the web. The Justice Department and a group of states had sued Google, arguing that its monopoly in ad technology allowed the company to charge higher prices and take a bigger portion of each sale.

“In addition to depriving rivals of the ability to compete, this exclusionary conduct substantially harmed Google’s publisher customers, the competitive process, and, ultimately, consumers of information on the open web,” said Brinkema, who also dismissed one portion of the government’s case.

Google has increasingly faced a reckoning over the dominant role its products play in how people get information and conduct business online.

Another federal judge ruled in August that the company had a monopoly in online search. He is now considering a request by the Justice Department to break up the company.

Brinkema, too, will have an opportunity to force changes to Google’s business. In its lawsuit, the Justice Department preemptively asked the court to force Google to sell some pieces of its ad technology business acquired over the years.

Together, the two rulings and their remedies could check Google’s influence and result in a sweeping overhaul of the company, which faces a potential major restructuring.

The ad tech case — U.S. et al. v. Google — was filed in 2023 and concerns an intricate web of programs that sell ad space around the web, like on a news site or a recipes page. The suite of software, which includes Google Ad Manager, conducts split-second auctions to place ads each time a user loads a page. That business generated $31 billion in 2023, or about 10% of the overall revenue for Google’s parent company, Alphabet.

Part of that business stems from the acquisition of DoubleClick, an advertising software company, for $3.1 billion in 2008. Google now has an 87% market share in ad-selling technology, according to the government.

The government argued during a three-week trial in September that Google had a monopoly over multiple pieces of technology that are used to conduct these transactions. The company locked publishers into using its software and was able to take more money off the top of each transaction because of its dominance, the government said.

That hurt websites that produce content and make it available for online for no charge, the government said.

Google countered that it faced competition not just from other ad tech companies but from social networks like TikTok and streaming platforms.