By Ruth Bender

BERLIN -- The German government and Deutsche Lufthansa AG said Monday they have agreed on a EUR9 billion euro ($9.81 billion) bailout deal -- one of the biggest aid packages by a single country hatched so far in the pandemic-hit air travel sector.

The deal, widely expected and weeks in the making, comes after the world's largest airlines have grounded a majority of their flights as most borders remain closed to contain the novel coronavirus. Airlines are furloughing or laying off tens of thousands of staff and negotiating bailouts with their governments.

"This is an important step as it's about more than 100,000 jobs, about preserving Germany's leading position in global civil aviation and about making sure that a healthy and tradition-rich company that got into trouble because of the coronavirus pandemic can exist also in the future, " Economy Minister Peter Altmaier told reporters Monday

Under the deal -- which still needs approval from Lufthansa's boards, shareholders and the European Commission -- the German government will take a 20% stake in the company and appoint two supervisory board seats.

The agreement caps a weekslong tug of war between Lufthansa's management and the government over how much control the latter should be given in return for financial support.

Lufthansa Chief Executive Carsten Spohr had warned against too much state influence on business decisions. Germany's economic stabilization fund, or WSF, agreed not to exercise its voting rights except in the event of a takeover, which would allow it to raise its stake to a blocking 25% plus one share. Mr. Altmaier said the deal would prevent foreign investors from taking advantage of the crisis.

WSF will build its 20% stake through a capital increase, acquiring new shares for a total of about EUR300 million in cash, Lufthansa said.

The EUR9 billion also include an equity injection by the government of up to EUR5.7 billion in the form of a silent participation that is unlimited in time and can be repaid by Lufthansa on a quarterly basis in whole or in part, as well as a EUR3 billion loan from state-backed bank KfW, of which EUR600 million will come from private banks.

Mr. Altmaier said the government was still in talks with the European Commission, the European Union's competition watchdog, which could impose conditions on the deal. He declined to comment on details of the talks.

German daily Handelsblatt reported earlier that Germany was resisting a push by the commission to have Lufthansa give up important landing slots at its Frankfurt and Munich hubs. A spokeswoman for the commission declined to comment.

Write to Ruth Bender at Ruth.Bender@wsj.com