The Wizards’ goal from the moment free agency began was to land Spencer Dinwiddie. Mission accomplished.

Washington sent a cohort of front-office members to meet with the former Nets guard in Los Angeles Monday afternoon at the onset of free agency. The two sides agreed to the bones of a deal quickly, but that was the easy part. A couple of days, countless phone calls, five teams and 18 trade pieces later, the hard part is now done, too.

Dinwiddie has agreed to a three-year, $62 million contract with the Wizards, sources say, and the Wizards have finalized the mega sign-and-trade that will bring him to D.C. The contract has a partial guarantee on the final season, a source said.

The 28-year-old Dinwiddie is coming off an ACL tear that limited him to only three games last season, but he is fully recovered today. He’s a 6-foot-5 guard who gets to the rim and forces his way to the free throw line at a top-notch rate. The Wizards like his fit, adding size and playmaking next to his new backcourt mate Bradley Beal, who helped recruit Dinwiddie.

This team was desperate for a point guard heading into free agency after agreeing to trade Russell Westbrook to the Lakers on draft night. Beal and Aaron Holiday were the only two playmaking guards on the roster. Now, the Wizards have their guy — after spending a couple of sleepless nights on the West Coast reworking the yet-to-become-official Westbrook trade to make it a five-team humdinger that included the acquisition of Dinwiddie.

The trade is filled with bits of trivia. It’s the first five-team deal since one between the Celtics, Heat, Grizzlies, Jazz and (just to date exactly how long ago this was) New Orleans/Oklahoma City Hornets 16 years ago. Today’s five-teamer involves the Wizards, Nets, Lakers, Pacers and Spurs.

This glorious mess of a trade has it all: stars, role players, guys picking up player options to get dealt, cash considerations, second-round picks, first-round picks, rights to international players, draft rights, pick swaps and trade exceptions.