---
abstract: 'We use one-and-a-half dimensional particle-in-cell plasma simulations to study the interaction of a relativistic, strongly magnetized wind with an ambient medium. Such an interaction is a plausible mechanism which leads to generation of cosmological $\gamma$-ray bursts. We confirm the idea of Mészáros and Rees (1992) that an essential part (about 20%) of the energy that is lost by the wind in the process of its deceleration may be transferred to high-energy electrons and then to high-frequency (X-ray and $\gamma$-ray) emission. We show that in the wind frame the spectrum of electrons which are accelerated at the wind front and move ahead of the front is nearly a two-dimensional relativistic Maxwellian with a relativistic temperature $T=m_ec^2\Gamma_{_T}/k\simeq 6\times 10^9\Gamma_{_T}$ K, where $\Gamma_{_T}$ is equal to $200\Gamma_0$ with the accuracy of $\sim 20$%, and $\Gamma_0$ is the Lorentz factor of the wind, $\Gamma_0\gtrsim 10^2$ for winds outflowing from cosmological $\gamma$-ray bursters. Our simulations point to an existence of a high-energy tail of accelerated electrons with a Lorentz factor of more than $\sim 700 \Gamma_0$. Large-amplitude electromagnetic waves are generated by the oscillating currents at the wind front. The mean field of these waves ahead of the wind front is an order 