It felt exceedingly treacherous and painstaking getting Major League Baseball back on the field, some 3½ months after it was effectively shuttered by a global pandemic, through a bitter and halting economic negotiation that still failed to deliver an agreement, and with seemingly each day bringing another body blow to the sport — in the form of a nasty letter from MLB to its players’ union or vice versa, or a fresh leak designed to embarrass the other side.

And then it was finally over Tuesday night, and the sport had a date for the reopening of “spring” training camps (July 1) and a new Opening Day of July 23 or 24, nearly four months behind schedule. The season will be 60 games, by far the shortest in the sport’s modern history, followed by a postseason.

“All remaining issues have been resolved,” the MLB Players Association tweeted at 8:41 p.m., marking the first official word of a deal, “and Players are reporting to training camps.”

“Major League Baseball is thrilled to announce that the 2020 season is on the horizon,” Commissioner Rob Manfred said in a statement less than an hour later. “We have provided the Players Association with a schedule to play 60 games and are excited to provide our great fans with Baseball again soon.”

But it was also clear that, despite all the effort expended, the vitriol spewed and the Armageddon barely staved off, the more treacherous and painstaking part is still to come — as baseball attempts to salvage a season amid a novel coronavirus pandemic that shows no sign of relenting in the United States and in fact is getting worse in some of the cities and states where baseball hopes to play.

The final elements were agreed to Tuesday night — the exhaustive and comprehensive health and safety protocols that both sides hope will guide the enterprise safely through the summer. Unlike other sports, baseball is aiming to play this season with teams in their home cities, as opposed to a one-site, quarantined “bubble.”

As players begin arriving to camps this week — all of which will be held at teams’ home cities, as opposed to spring training facilities in Arizona and Florida — they will be tested for the coronavirus before being allowed to enter, the first of many tests each player and staff member will be subjected to.

Teams will be aligned geographically to reduce travel, and while MLB has yet to release a master schedule for the 2020 season, each team reportedly will play 40 games within their own division and 20 against teams from the corresponding division in the other league. Thus, the defending World Series champion Washington Nationals would play 10 games each against division rivals Atlanta, Miami, Philadelphia and the New York Mets, and four each against AL East teams Baltimore, Boston, the New York Yankees, Tampa Bay and Toronto.

It will be a season unlike any in the sport’s history, featuring, among other wrinkles, a designated hitter in the National League for the first time, and probably extra innings that begin with a runner on second base.

The season will also be played, by necessity, without fans in ballparks, at least initially.

Although neither side expected the health and safety issues to torpedo an agreement, there were countless factors to sort through, with the landscape around the coronavirus outbreak growing more daunting almost by the day. Several states across the Sun Belt, home to more than a third of MLB teams, have seen their case numbers spike in recent weeks.

Already, the Philadelphia Phillies have confirmed an outbreak stemming from their spring headquarters in Clearwater, Fla., in which at least seven players and five staff members have tested positive — one of several developments that prompted MLB to shutter all spring training facilities last week.

And Tuesday night, within minutes of MLB’s announcement of a deal to start the season, the Denver Post reported three members of the Colorado Rockies, including all-star outfielder Charlie Blackmon, had tested positive.

Among the most pressing matters in the health and safety negotiation was how to deal with players who opt out of playing in 2020, either because they have medical conditions that make them high-risk or because they have made a personal calculation that the risk of contracting the coronavirus outweighs the reward. Players will earn 37 percent of their original 2020 salaries if the season reaches its full 60 games.

The agreement assures players who are deemed high-risk and who opt out will receive full pay and service time. The union had sought the same protections for players who live with individuals deemed high-risk, including pregnant spouses, but MLB ultimately balked. Instead, those players would automatically be eligible for up to 10 days of pay and service time through the Paternity List and Family Medical Emergency List, but further compensation would be up to the individual team.

This would apply not only to players who have family members with medical conditions — such as Nationals reliever Sean Doolittle, whose wife, Eireann Dolan, has asthma — but also players whose wives are due to give birth this summer, a group that includes Los Angeles Angels center fielder Mike Trout and New York Yankees pitcher Gerrit Cole.

The shift in focus from economics to health and safety came after the sides failed to reach agreement on the former, leaving MLB to implement its own schedule — which it had the power to do as long as players are paid full, prorated shares of their 2020 salaries and the health and safety protocols are agreed to.

After the union’s executive board voted Monday to reject MLB’s final proposal, a 60-game regular season and an expanded, 16-team postseason, MLB indicated it would implement a regular season schedule of that length, though it did not have the power to implement the expanded postseason.

This story has been updated to correct details of the health and safety negotiations.

Read more on baseball: