Ahimsa is the foremost Dharma There is no doubt about it.

You are talking about animals suffering in the hands of humans. But we barely realize that all of us are suffering in the hands of Karma (fate). In order to get answers to the question of ‘what for’ and ‘why’, you should try and understand God. That is the only way. Until then, whatever I say would only be a consolation.

Practice Ahimsa as far as practically possible and chant Mahamantra all the time. Instead of analyzing the swept dirt, why not just find a way to destroy them?

Even with respect to Gods, there are three types of Gods – Sattvic, Rajasic and Tamasic. Rajasic and tamasic Gods are offered animal sacrifices and alcohol. Sattvic offerings are done to Sattvic Gods.

In general one inherits the qualities of the God whom he propitiates. So it is always advisable to propitiate Sattvic deities.

All the main religions (viz. Hinduism, Islam, Christianity) propagate non-violence, however, allow to some extent sacrifices in the Name of God. The speciality about Hinduism is that, it is permitted and prohibited according to the way of one's life. A householder is allowed to kill beings in order to protect himself and lead his life, whereas when a renunciate ('Sanyasi') kills even a small living being even if it afflicts pain on him, it is considered a grave sin.

In general, according to our Shastras, it is sin to kill harmless and helpless living beings. They prescribe that by doing so, one would be afflicted with skin diseases in his next birth. It is advisible to do the minimum amount of harm to other beings to lead a peaceful and happy life.

The dharma prescribed varies as per the Ashrama. that is, if one is a Sanyasi - (a renounced person), the prescribed norms are very stringent. If he kills an insect even if it harms him it is a sin. He is not allowed to do so. but for a householder, it is different. If an insect harms him, he can kill it, if necessary. That would not amount to a sin. but if he does it purposefully or for pleasure it is a sin.

Shastras state that if a person kills helpless beings like insects and flies, he will contract skin diseases in his future birth.

In short, a householder can kill an insect as an act of self-defense if harmed by it. It is not a sin.