ATHENS, Greece — Greece is considering requesting an extension to its loan agreement, government officials said Tuesday, in an effort to reach a last-minute deal with the country’s European creditors and avoid the danger of a euro exit.

The country would submit the request before Friday, said the officials, who spoke on condition of anonymity pending the formal announcement. They stressed the request would not be for an extension of Greece’s bailout agreement, which includes strict cost-cutting measures as conditions for rescue loans.

The move follows an ultimatum issued by eurozone finance ministers after their meeting to find a solution for Greece collapsed Monday night. They have said Greece must ask for an extension to its current bailout by the end of the week in order to reconvene a meeting.

It was unclear whether the Greek request would meet the requirements of the country’s creditors, but the news was greeted with some market optimism.

U.S. stocks moved slightly higher, and the euro also gained some lost ground against the dollar.

“Greece’s new government wants more independence, but it doesn’t want that independence at all costs,” said Anastasia Amoroso, a global market strategist at JPMorgan Funds. “The extension is good news because it buys Greece and the eurozone time to reach a long-term resolution.”

Greece’s new left-wing government won elections last month on a promise to renegotiate the country’s bailout agreement. That deal provided 240 billion euros in rescue loans from other EU countries and the International Monetary Fund, but came on the condition that Athens imposed draconian austerity measures in return.

Time is running out for the two sides to reach an agreement. The European part of Greece’s bailout program expires on Feb. 28, after which the country will struggle to service its debts.

Earlier Tuesday, Prime Minister Alexis Tsipras sounded a defiant note, saying Greece will not compromise in talks with its European creditors, but that it is working for an “honest and mutually beneficial agreement.”

The failure in Monday’s meeting of eurozone finance ministers has increased fears Greece may be forced out of the joint euro currency, although investors seem to believe the two sides will eventually reach an agreement.