How I know and read in the Internet that Ampere realized that two current-carrying wires can exert force on each other. Ampere's force law is: $$d^2\vec{F_{21}}=-\frac{\mu_0}{4\pi}i_1i_2\frac{\hat{r}}{r^2}\left[2(d\vec{\ell_1}\cdot d\vec{\ell_2})-3(\hat{r}\cdot d\vec{\ell_1})(\hat{r}\cdot d\vec{\ell_2})\right]=-d^2\vec{F_{12}}$$
Where $i_2d\vec{\ell_2}$ and $i_1d\vec{\ell_1}$ are the current elements of the wires. And the circuital law is: $$\oint \vec B\cdot d\vec l=\mu_oI_{net}$$
My question is which law was first written? Does Ampere extract the circuital law from the force equation above? Does the mathematical form of the magnetic field equation is the original form that Ampere wrote or it came later by another scientists and if so, then what is the original formulation.