The U.S. Senate has approved a $91 billion package that will continue funding the wars in Afghanistan and Iraq and provide assistance to Pakistan by a vote 86-3 late Thursday. The measure will have to be reconciled with a House-passed version before a final bill is sent to President Barack Obama for his signature.

Most of the funds are to help pay for continued U.S. military operations in Iraq and Afghanistan. Some $400 million are to go toward training Pakistan's counterinsurgency forces, while $500 million are to be spent on economic aid to Pakistan.

The bill also includes funding for peacekeeping operations in Somalia, security programs along the U.S.-Mexico border and for the global fight against AIDS.

Senator Inouye praises bill

The chairman of the Senate Appropriations Committee, Democratic Senator Daniel Inouye of Hawaii, praised the bill.

"This is a good bill, and it is necessary to deal with a myriad of problems," he said.

But the measure does not contain everything President Obama had wanted.

Money to close Guantanamo withdrawn

The Senate earlier this week followed the lead of the House of Representatives and took out $80 million to close the U.S. detention center at Guantanamo Bay, Cuba. Lawmakers argued that it was premature to fund the closure before a plan was established on what to do with the 240 detainees housed there.

Earlier Thursday, the Senate approved a $100 billion U.S. line of credit to the International Monetary Fund, rejecting a Republican-sponsored amendment to remove the commitment from the bill. The IMF could use the line of credit to shore up the ability of countries to cope with financial crises.

Kerry supports IMF provision

Senator John Kerry, a Massachusetts Democrat and chairman of the Senate Foreign Relations Committee, spoke in support of the IMF provision.

"The fact is that if those emerging markets start to fade, not only do we lose the economic upside of those markets, but we also run the risk that governments fail," Kerry said.

The House and Senate will be in recess next week, but negotiators for both chambers are expected to reach a compromise on the legislation soon after lawmakers return in early June.