Accidental or Intentional

The ideal and preferred means of observing or fulfilling a halacha is called l'chatchila. Sometimes the halacha's requirements may be fulfilled b'di'avad (after the fact) under less-than-ideal circumstances. 
You may not intentionally do an action at the b'diavad level if you are able to do it at the l'chatchila level.