I read that Morocco/Western Sahara has 75% of the world's known phosphate reserves, but I couldn't find an explanation of what mineral is responsible for it and how it all ended up there
Apatite is slowly soluble in neutral or alkaline waters, and its solubility increases with increasing acidity.
The PO4 content of most river and lake waters ranges from about 0.01 to 0.5 part per million (ppm), but may be much higher in soft acid waters and highly saline alkaline lakes. About one-sixth of the phosphate carried to the sea by runoff is in dissolved form. The ocean as a whole is nearly saturated with phosphate, but its distribution within the ocean is not uniform; deep cold waters contain nearly 0.3 ppm PO*, but warm surface waters contain only 0.01 ppm or less. Oceanic circulation brings phosphate- rich water to the surface in several environments, and phosphate may be precipitated either inorganically or biochemically, as the pH and temperature increase near the surface.
Most of the world's phosphate production comes from marine phosphorites, many of which are associated with black shale and chert. Secondary processes including diagenetic phosphatization of calcium carbonate and .interstitial precipitation, reworking by waves and currents, and weathering have often played a prominent part in forming deposits of mineable quality.
Common igneous rocks, such as granite, diorite, gabbro, and peridotite, contain only from about 0.005 to 0.4 percent P205 , but some of the less common alkalic rocks, such as ijolite and turjaite, can contain more than 1 percent. Variations in phosphate content of igneous rocks generally parallel those of ilmenite and magnetite.Apatite is slowly soluble in neutral or alkaline waters, and its solubility increases with increasing acidity, decreasing hardness, and decreasing temperature.
Most phosphorus is carried to the sea as phosphate minerals or adsorbed on iron or aluminum hydroxides or clay.
Most of the world's phosphate production comes from marine phosphorites. The richest and largest of these form at low latitudes in areas of upwelling associated with divergence, chiefly along the west coasts of the continents or, in large mediterranean seas, along the equatorial side of the basin. Lesser but significant concentrations form along the west sides of poleward-moving warm currents along the eastern coasts of continents.
In the Moroccan phosphate deposits however,
The unconsolidated sediments on the continental shelf and uppermost continental slope off Morocco and the Spanish Sahara are sands, silty sands, and silts. Their sand fraction is carbonate-rich and considered to be mainly relict from Pleistocene times when sea level was lower. This relict sand is mixed with, and locally buried by, Holocene detrital silts which are concentrated on the slope and the middle shelf. Phosphate is locally abundant in the form of sand-sized detrital grains. These were derived from Cretaceous and Tertiary phosphatic rocks cropping out on the shelf, by erosion during the Pleistocene. The sand-sized phosphatic detritus is concentrated in relict placer-type deposits near parent-rock outcrops. Longshore transport during the Pleistocene has contributed further concentrations of phosphatic sand along the shelf edge. These deposits are of low grade (< 8% P 2O 5) and are of no economic interest at present. No signs of Recent phosphate mineral formation were noted. Thus, the hypothesis that this phenomenon is linked with the upwelling of nutrient-rich water does not appear to apply, at this time, to the region studied.